def fsize_fmt(num, suffix='b'):
    """
    Format an integer into 1024-block file size format.

    Adapted from Python 2 code on
    https://stackoverflow.com/a/1094933/3758232

    :param int num: Size value in bytes.
    :param str suffix: Suffix label (defaults to ``b``).

    :rtype: str
    :return: Formatted size to largest fitting unit.
    """
    for unit in ['','K','M','G','T','P','E','Z']:
        if abs(num) < 1024.0:
            return f'{num:3.1f} {unit}{suffix}'
        num /= 1024.0
    return f'{num:.1f} Y{suffix}'