code: def format_list(extracted_list):
      
      list = []
      for filename, lineno, name, line in extracted_list:
          item = '  File "%s", line %d, in %s\n' % (filename,lineno,name)
          if line:
              item = item + '    %s\n' % line.strip()
          list.append(item)
      return list
docs: Format a list of traceback entry tuples for printing.
  
      Given a list of tuples as returned by extract_tb() or
      extract_stack(), return a list of strings ready for printing.
      Each string in the resulting list corresponds to the item with the
      same index in the argument list.  Each string ends in a newline;
      the strings may contain internal newlines as well, for those items
      whose source text line is not None.