def tidy_stacktrace(stack):
 trace = []
 for (frame, path, line_no, func_name, text) in (f[:5] for f in stack):
  if omit_path(os.path.realpath(path)):
   continue
  text = (u''.join((force_text(t) for t in text)).strip() if text else u'')
  trace.append((path, line_no, func_name, text))
 return trace

def tidy_stacktrace ( stack ) : trace = [ ] for ( frame , path , line_no , func_name , text ) in ( f [ : 5 ] for f in stack ) : if omit_path ( os . path . realpath ( path ) ) : continue text = ( u'' . join ( ( force_text ( t ) for t in text ) ) . strip ( ) if text else u'' ) trace . append ( ( path , line_no , func_name , text ) ) return trace
clean up stacktrace and remove all entries that: 1 .