def _compile(data):
    "Format string as a series of timing codes for execution."
    code = []
    for word in ''.join(key for key in data.upper() if key in CODE).split():
        for character in word:
            for symbol in CODE[character]:
                code.extend(((DAH, DOT)[symbol == '.'], DOT))
            code[-1] = DAH
        code[-1] = SEP
    return tuple(code)
Format string as a series of timing codes for execution.
recipes/Python/578012_Morse_Code/recipe-578012.py