parameters: (etype, evalue, etb, context=5, tb_offset=0)
return_statement: return '%s\n%s\n%s' % (head, '\n'.join(frames), ''.join(exception[0]))
docstring: Return a nice text document describing the traceback.
  
          Parameters
          -----------
          etype, evalue, etb: as returned by sys.exc_info
          context: number of lines of the source file to plot
          tb_offset: the number of stack frame not to use (0 = use all)
docstring_summary: Return a nice text document describing the traceback.
docstring_tokens: Return a nice text document describing the traceback .
function: def format_exc(etype, evalue, etb, context=5, tb_offset=0):
      """ Return a nice text document describing the traceback.
  
          Parameters
          -----------
          etype, evalue, etb: as returned by sys.exc_info
          context: number of lines of the source file to plot
          tb_offset: the number of stack frame not to use (0 = use all)
  
      """
      # some locals
      try:
          etype = etype.__name__
      except AttributeError:
          pass
  
      # Header with the exception type, python version, and date
      pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable
      date = time.ctime(time.time())
      pid = 'PID: %i' % os.getpid()
  
      head = '%s%s%s\n%s%s%s' % (etype, ' ' * (75 - len(str(etype)) - len(date)),
                             date, pid, ' ' * (75 - len(str(pid)) - len(pyver)),
                             pyver)
  
      # Flush cache before calling inspect.  This helps alleviate some of the
      # problems with python 2.3's inspect.py.
      linecache.checkcache()
      # Drop topmost frames if requested
      try:
          records = _fixed_getframes(etb, context, tb_offset)
      except:
          raise
          print('\nUnfortunately, your original traceback can not be '
                'constructed.\n')
          return ''
  
      # Get (safely) a string form of the exception info
      try:
          etype_str, evalue_str = map(str, (etype, evalue))
      except:
          # User exception is improperly defined.
          etype, evalue = str, sys.exc_info()[:2]
          etype_str, evalue_str = map(str, (etype, evalue))
      # ... and format it
      exception = ['%s: %s' % (etype_str, evalue_str)]
      frames = format_records(records)
      return '%s\n%s\n%s' % (head, '\n'.join(frames), ''.join(exception[0]))
function_tokens: def format_exc ( etype , evalue , etb , context = 5 , tb_offset = 0 ) : # some locals try : etype = etype . __name__ except AttributeError : pass # Header with the exception type, python version, and date pyver = 'Python ' + sys . version . split ( ) [ 0 ] + ': ' + sys . executable date = time . ctime ( time . time ( ) ) pid = 'PID: %i' % os . getpid ( ) head = '%s%s%s\n%s%s%s' % ( etype , ' ' * ( 75 - len ( str ( etype ) ) - len ( date ) ) , date , pid , ' ' * ( 75 - len ( str ( pid ) ) - len ( pyver ) ) , pyver ) # Flush cache before calling inspect.  This helps alleviate some of the # problems with python 2.3's inspect.py. linecache . checkcache ( ) # Drop topmost frames if requested try : records = _fixed_getframes ( etb , context , tb_offset ) except : raise print ( '\nUnfortunately, your original traceback can not be ' 'constructed.\n' ) return '' # Get (safely) a string form of the exception info try : etype_str , evalue_str = map ( str , ( etype , evalue ) ) except : # User exception is improperly defined. etype , evalue = str , sys . exc_info ( ) [ : 2 ] etype_str , evalue_str = map ( str , ( etype , evalue ) ) # ... and format it exception = [ '%s: %s' % ( etype_str , evalue_str ) ] frames = format_records ( records ) return '%s\n%s\n%s' % ( head , '\n' . join ( frames ) , '' . join ( exception [ 0 ] ) )