def format_units(v, step=None, system="si", units=None):
    """Format the given value in standardized units.

    ``system`` is either 'binary' or 'si'

    For more info, see:
        http://en.wikipedia.org/wiki/SI_prefix
        http://en.wikipedia.org/wiki/Binary_prefix
    """
    if v is None:
        return 0, ''

    for prefix, size in UnitSystems[system]:
        if condition(v, size, step):
            v2 = v / size
            if v2 - math.floor(v2) < 0.00000000001 and v > 1:
                v2 = float(math.floor(v2))
            if units:
                prefix = "%s%s" % (prefix, units)
            return v2, prefix

    if v - math.floor(v) < 0.00000000001 and v > 1:
        v = float(math.floor(v))
    if units:
        prefix = units
    else:
        prefix = ''
    return v, prefix
Format the given value in standardized units.

    ``system`` is either 'binary' or 'si'

    For more info, see:
        http://en.wikipedia.org/wiki/SI_prefix
        http://en.wikipedia.org/wiki/Binary_prefix
    
graphite_api/render/glyph.py