def encode(source, destination, major_key, minor_key):
    'Encode from source to destination via Major and Minor Keys.'
    _check_major(major_key)
    _check_minor(minor_key)
    map_1 = map(ord, major_key)
    map_2 = _setup_minor(minor_key)
    character = source.read(1)
    while character:
        byte = map_1[ord(character)]
        for shift in xrange(6, -2, -2):
            destination.write(map_2[(byte >> shift) & 3][_random.randrange(64)])
        character = source.read(1)
    destination.flush()
Encode from source to destination via Major and Minor Keys.
recipes/Python/577008_Profile_Manager_21/recipe-577008.py