from itertools import cycle


def encrypt_with_xor(message, key):
    """Encrypt message using xor cipher with key. The ascii code for each
    character of message is returned after the xor function is applied to each
    bit of the character with the ascii code of the cycling key.
    The algorithim is symmetric, the same process with the same key will both
    encrypt and decrypt.
    """

    coded_message = ''
    for (message_char, key_char) in zip(message, cycle(key)):
        coded_char = chr(ord(message_char) ^ ord(key_char))
        coded_message += coded_char
    return coded_message