def format_byte_size(value: int, unit: str = 'B', factor: int = 1024, include_unit=True) -> str:
    """
    Given an integer *value*, this function formats the number which is assumed to be a size in bytes into a different
    byte related unit such as kilobytes, megabytes etc.

    :param int value: The actual integer amount of bytes to be converted into another unit
    :param int factor: The factor which seperates two denominations of units. By default this is 1024 which is correct
        when working with bytes. Should not be changed.
    :param str unit: The string identifier of the unit to be converted to. May only be one of the following strings:
        B, KB, MB, GB, TB. Default is B (Bytes)
    :param bool include_unit: A boolean flag which determines whether or not the unit string should be included in the
        final returned string value.

    :returns: The string representation of the formatted value, now (potentially) in the new unit. The numeric value
        within the string will have two decimals accuracy
    """
    unit = unit.upper()
    unit_factors = {
        'B': factor ** 0,
        'KB': factor ** 1,
        'MB': factor ** 2,
        'GB': factor ** 3,
        'TB': factor ** 4
    }

    # It is important to raise an appropriate error message. In this case if the unit string identifier is not valid.
    if unit not in unit_factors.keys():
        raise ValueError(f'You have passed {unit} to specific the unit to format a byte value. This is not a valid '
                         f'unit identifier! Please use one of the following: {", ".join(unit_factors.keys())}')

    value_string = f'{value / unit_factors[unit]:.2f}'

    # Optional flag of whether or not to include the unit in the final string output
    if include_unit:
        value_string += f' {unit}'

    return value_string