def sizeof_fmt(num, suffix='B'):
    """Returns human-readable file size

    Supports:
     * all currently known binary prefixes
     * negative and positive numbers
     * numbers larger than 1000 Yobibytes
     * arbitrary units (maybe you like to count in Gibibits!)

    Example:
    --------
    >>> sizeof_fmt(168963795964)
    '157.4GiB'

    Parameters:
    -----------
    num : int
        Size of file (or data), in bytes

    suffix : str, optional
        Unit suffix, 'B' = bytes by default

    Returns:
    --------
    str
        <floating number><prefix><unit>
    """
    for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
        if abs(num) < 1024.0:
            return "%3.2f %s%s" % (num, unit, suffix)
        num /= 1024.0
    return "%.2f %s%s" % (num, 'Yi', suffix)