def unbalance(A, B, C, all=False):
    """
    Voltage/Current Unbalance Function.

    Performs a voltage/current unbalance calculation
    to determine the maximum current/voltage
    unbalance. Returns result as a decimal percentage.

    Parameters
    ----------
    A:          float
                Phase-A value
    B:          float
                Phase-B value
    C:          float
                Phase-C value
    all:        bool, optional
                Control argument to require function
                to return all voltage/current unbalances.

    Returns
    -------
    unbalance:  float
                The unbalance as a percentage of the
                average. (i.e. 80% = 0.8)
    """
    # Condition Inputs
    A = abs(A)
    B = abs(B)
    C = abs(C)
    # Gather Average
    avg = (A + B + C) / 3
    # Determine Variance
    dA = abs(A - avg)
    dB = abs(B - avg)
    dC = abs(C - avg)
    # Gather Maximum Variation
    mx = max(dA, dB, dC)
    # Calculate Maximum Variation
    unbalance = mx / avg
    # Return Results
    if all:
        return (dA / avg, dB / avg, dC / avg)
    else:
        return (unbalance)