def wrap_traceback(traceback):
 if (email().format == 'html'):
  try:
   from pygments import highlight
   from pygments.lexers import PythonTracebackLexer
   from pygments.formatters import HtmlFormatter
   with_pygments = True
  except ImportError:
   with_pygments = False
  if with_pygments:
   formatter = HtmlFormatter(noclasses=True)
   wrapped = highlight(traceback, PythonTracebackLexer(), formatter)
  else:
   wrapped = ('<pre>%s</pre>' % traceback)
 else:
  wrapped = traceback
 return wrapped

def wrap_traceback ( traceback ) : if ( email ( ) . format == 'html' ) : try : from pygments import highlight from pygments . lexers import PythonTracebackLexer from pygments . formatters import HtmlFormatter with_pygments = True except ImportError : with_pygments = False if with_pygments : formatter = HtmlFormatter ( noclasses = True ) wrapped = highlight ( traceback , PythonTracebackLexer ( ) , formatter ) else : wrapped = ( '<pre>%s</pre>' % traceback ) else : wrapped = traceback return wrapped
for internal use only .