def sizeof_fmt(num: float) ->str:
    """Generates the human-readable version of a file size.

    >>> sizeof_fmt(512)
    512bytes
    >>> sizeof_fmt(2048)
    2KB

    :param num: Robot-readable file size in bytes
    :return: Human-readable file size"""
    for item in ['bytes', 'KB', 'MB', 'GB']:
        if num < 1024.0:
            return '%3.1f%s' % (num, item)
        num /= 1024.0
    return '%3.1f%s' % (num, 'TB')
