def key(definition, select):
    'Returns a valid key.'
    key = range(256)
    for index in range(256):
        key[ord(definition[index * 2 + int(bool(select))])] = definition[index * 2 + int(not bool(select))]
    return ''.join(key)