def bytes2human(bts: int) -> str:
    """
    http://code.activestate.com/recipes/578019

    >>> bytes2human(10000)
    '9.8K'
    >>> bytes2human(100001221)
    '95.4M'
    """
    symbols = "YZEPTGMK"
    nums = (1 << i for i in range(80, 9, -10))
    return next((f"{bts / n:.1f}{s}"
                 for s, n in zip(symbols, nums) if bts >= n), f"{bts}B")