<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def xor(key, data):
 """ Perform cyclical exclusive or operations on ``data``. The ``key`` can be a an integer *(0 <= key < 256)* or a byte sequence. If the key is smaller than the provided ``data``, the ``key`` will be repeated. Args: key(int or bytes):
 The key to xor ``data`` with. data(bytes):
 The data to perform the xor operation on. Returns: bytes: The result of the exclusive or operation. Examples: b'DGFA' b'ABCD' b'15-=51)19=%5=9!)!%=-%!9!)-' b'ABCDEFGHIJKLMNOPQRSTUVWXYZ' """


    if type(key) is int:
        key = six.int2byte(key)
    key_len = len(key)

    return b''.join(
        six.int2byte(c ^ six.indexbytes(key, i % key_len))
        for i, c in enumerate(six.iterbytes(data))
    )