import math


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

    Args:
        num (int): Number of unit size.
        suffix (str): Unit of size (default: B).

    """
    mag = int(math.floor(math.log(num, 1024)))
    val = num / math.pow(1024, mag)
    if mag > 7:
        return f"{val:.1f}Y{suffix}"
    else:
        return f"{val:3.1f}{['','K','M','G','T','P','E','Z'][mag]}{suffix}"