<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def number_to_bytes(n, endian='big'):
 """ Convert an integer to a corresponding string of bytes.. :param n: Integer to convert. :param endian: Byte order to convert into ('big' or 'little' endian-ness, default 'big') Assumes bytes are 8 bits. This is a special-case version of number_to_string with a full base-256 ASCII alphabet. It is the reverse of ``bytes_to_number(b)``. Examples:: b'*' b'\\xff' b'\\x01\\x00' b'\\x00\\x01' """

    res = []
    while n:
        n, ch = divmod(n, 256)
        if PY3:
            res.append(ch)
        else:
            res.append(chr(ch))

    if endian == 'big':
        res.reverse()

    if PY3:
        return bytes(res)
    else:
        return ''.join(res)