def key_to_alpha(key):
    """ Generate alphabet for key 

    Idea is run through the key, dropping any 
    letters already seen.
 
    Then go back to the beginning of the alphabet and 
    write letters out that are not in the key.
    """
    alphabet = ''
    used = set()
    for c in key:
        if c.lower() not in used:
            alphabet += c
            used.add(c)
    a = ord('a')
    for xx in range(26):
        c = chr(a + xx)
        if c not in used:
            alphabet += c
    return alphabet
