def readable_size(size: float) ->str:
    """Represent file size in human-readable format.

    .. code:: python

        >>> readable_size(1024 * 1024)
        "1.00M"

    :param size: File size in bytes.
    """
    units = ['', 'K', 'M', 'G', 'T', 'P']
    for unit in units[:-1]:
        if size < 1024:
            return f'{size:.2f}{unit}'
        size /= 1024
    return f'{size:.2f}{units[-1]}'
