def size_human(size):
    """
    Make the size in bytes to a more human readable format.

    This function compares the size value with some thresholds and returns
    a new value with the appropriate suffix (K, M, T, P). The correct input
    is an integer value not a string!!!

    >>> size_human(755745434)
    '721.0M'
    """

    if size:
        _abbrevs = [
        (1<<50L, 'P'),
        (1<<40L, 'T'),
        (1<<30L, 'G'),
        (1<<20L, 'M'),
        (1<<10L, 'k'),
        (1, 'bytes')]

        for factor, suffix in _abbrevs:
            if size > factor:
                break
        if factor == 1:
            return "%d %s" % (size, suffix)
        else:
            return (float(size)/float(factor), suffix) % "%.3f%s"
dataset/ETHPy150Open rvanlaar/easy-transifex/src/transifex/transifex/txcommon/utils.py/size_human/swapped operands of `%`