def html_highlight(classified_text,opener='<pre class="python">\n', closer='</pre>\n'):
    'Convert classified text to an HTML fragment'
    result = [opener]
    for kind, text in classified_text:
        if kind:
            result.append('<span class="%s">' % kind)
        result.append(cgi.escape(text))
        if kind:
            result.append('</span>')
    result.append(closer)
    return ''.join(result)
Convert classified text to an HTML fragment
recipes/Python/578178_Colorize_Pyth_Sourcecode_Syntax/recipe-578178.py