def etraceback(prep, exc_info):
 out = ''
 for line in traceback.format_exception(exc_info[0], exc_info[1], exc_info[2]):
  out += ('%s: %s' % (prep, line))
 return out

def etraceback ( prep , exc_info ) : out = '' for line in traceback . format_exception ( exc_info [ 0 ] , exc_info [ 1 ] , exc_info [ 2 ] ) : out += ( '%s: %s' % ( prep , line ) ) return out
enhanced traceback formats traceback into lines "prep: line name: line" .