def bytes2human(n):
    symbols = ('K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
    prefix = {}
    for i, s in enumerate(symbols):
        prefix[s] = 1 << (i + 1) * 10
    for s in reversed(symbols):
        if n >= prefix[s]:
            value = int(float(n) / prefix[s])
            return '%s%s' % (value, s)
    return "%sB" % n
Returns:
dataset/ETHPy150Open giampaolo/psutil/scripts/top.py/bytes2human--crossover with--dataset/ETHPy150Open meraki-analytics/cassiopeia/cassiopeia/type/core/summoner.py/MasteryPage.current