code: 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,
      )
  
      # Drop topmost frames if requested
      records = _fixed_getframes(etb, context, tb_offset)
  
      # 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]),
      )
  
file_path: mlens/mlens/externals/joblib/format_stack.py
imports: import inspect
  import keyword
  import linecache
  import os
  import pydoc
  import sys
  import time
  import tokenize
  import traceback
label_desc: Use image node_id 8 for calling a global function with example usage: format_exc(etype, evalue, etb, context, tb_offset) and returns: unknown