code: def exception(maxTBlevel=None):
      
  
      try:
          from marrow.util.bunch import Bunch
  
          cls, exc, trbk = sys.exc_info()
          excName = cls.__name__
          excArgs = getattr(exc, 'args', None)
  
          excTb = ''.join(traceback.format_exception(cls, exc, trbk, maxTBlevel))
  
          return Bunch(
                  name=excName,
                  cls=cls,
                  exception=exc,
                  trace=trbk,
                  formatted=excTb,
                  args=excArgs
              )
  
      finally:
          del cls, exc, trbk
docs: Retrieve useful information about an exception.
  
      Returns a bunch (attribute-access dict) with the following information:
  
      * name: exception class name
      * cls: the exception class
      * exception: the exception instance
      * trace: the traceback instance
      * formatted: formatted traceback
      * args: arguments to the exception instance
  
      This functionality allows you to trap an exception in a method agnostic to
      differences between Python 2.x and 3.x.