def ansi_highlight(classified_text, colors=default_ansi):
    'Add syntax highlighting to source code using ANSI escape sequences'
    # http://en.wikipedia.org/wiki/ANSI_escape_code
    result = []
    for kind, text in classified_text:
        opener, closer = colors.get(kind, ('', ''))
        result += [opener, text, closer]
    return ''.join(result)
Add syntax highlighting to source code using ANSI escape sequences
recipes/Python/578178_Colorize_Pyth_Sourcecode_Syntax/recipe-578178.py