def bytes_to_string(bytes):
    """
    It generates a string with a proper format to represent bytes.

    Parameters
    ----------
    bytes : int
        A quantity of bytes

    Returns
    -------
    size_str : str
        The string representing the number of bytes with a proper format
    """
    kilobytes = bytes / 1000

    if kilobytes < 1.0:
        return '{:.2f} B'.format(bytes)

    megabytes = kilobytes / 1000.0
    if megabytes < 1.0:
        return '{:.2f} kB'.format(kilobytes)

    gigabytes = megabytes / 1000
    if gigabytes < 1.0:
        return '{:.2f} MB'.format(megabytes)

    terabytes = gigabytes / 1000
    if terabytes < 1.0:
        return '{:.2f} GB'.format(gigabytes)

    return '{:.2f} TB'.format(terabytes)