def format_filesize(value):
    """ Return a human readable filesize for a given byte count """
    if not value:
        return ""
    for x in ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB']:
        if value < 1024.0:
            return "%3.1f %s" % (value, x)
        value /= 1024.0
    return value