def humanize_filesize(value):
    """ Return an humanized file size.
    """

    value = float(value)

    if value == 1:
        return '1 Byte'
    elif value < 1024:
        return '%d Bytes' % value
    elif value < 1024:
        return '%dB' % value

    for i, s in enumerate(SUFFIXES):
        unit = 1024 ** (i + 2)
        if value < unit:
            return '%.1f %s' % ((1024 * value / unit), s)
    return '%.1f %s' % ((1024 * value / unit), s)
def humanize_filesize ( value ) : value = float ( value ) if value == 1 : return '1 Byte' elif value < 1024 : return '%d Bytes' % value elif value < 1024 : return '%dB' % value for i , s in enumerate ( SUFFIXES ) : unit = 1024 ** ( i + 2 ) if value < unit : return '%.1f %s' % ( ( 1024 * value / unit ) , s ) return '%.1f %s' % ( ( 1024 * value / unit ) , s )
Return an humanized file size.