code: def format_exception(etype, value, tb, limit = None):
      
      if tb:
          list = ['Traceback (most recent call last):\n']
          list = list + format_tb(tb, limit)
      else:
          list = []
      list = list + format_exception_only(etype, value)
      return list
docs: Format a stack trace and the exception information.
  
      The arguments have the same meaning as the corresponding arguments
      to print_exception().  The return value is a list of strings, each
      ending in a newline and some containing internal newlines.  When
      these lines are concatenated and printed, exactly the same text is
      printed as does print_exception().