code: def exception_format():
      
      return "".join(traceback.format_exception(
          sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]
      ))
docs: Convert exception info into a string suitable for display.