def ansi_highlight(classified_text, colors=default_ansi):
 result = []
 for (kind, text) in classified_text:
  (opener, closer) = colors.get(kind, ('', ''))
  result += [opener, text, closer]
 return ''.join(result)

def ansi_highlight ( classified_text , colors = default_ansi ) : 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 .