def sizeof_fmt(bytes_size, forced_unit='B'):
    """
    Convert the size into a more human readable format.
    The final unit could be forced by the second param.
        :param bytes_size: Size to convert (in bytes)
        :param forced_unit='B': Output unit. Could be choosen between :
            B, KB, MB, GB, TB, PB, EB, ZB, KiB, MiB, GiB, TiB, PiB, EiB, ZiB

    Note : Inspired from
    https://web.archive.org/web/20111010015624/http://blogmag.net/blog/read/38/Print_human_readable_file_size # noqa #pylint: disable
    """
    forced_unit = forced_unit.lower()
    if 'i' in forced_unit:
        divisor = 1024.0
        units = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB']
    else:
        divisor = 1000.0
        units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB']
    lower_units = map(str.lower, units)
    if forced_unit in lower_units or forced_unit == '':
        for unit in units:
            if abs(bytes_size
                ) < divisor and forced_unit == '' or forced_unit == unit.lower(
                ):
                if isinstance(bytes_size, int):
                    if bytes_size > 9007199254740992:
                        print(bytes_size)
                        raise ArithmeticError(
                            'The bytes_size variable (value : %s) is not convenient with IEEE754 standard. It is not a representable integer, that means it is upper than 2^54+1'
                             % bytes_size)
                return '%3.1f%s' % (bytes_size, unit)
            bytes_size /= divisor
    return '%.1f%s' % (bytes_size, 'B')
