code: def start_debugging():
      
      exc_type, exc_value, exc_tb = sys.exc_info()
  
      # If the exception has been annotated to be re-raised, raise the exception
      if hasattr(exc_value, '_ipdbugger_let_raise'):
          raise_(*sys.exc_info())
  
      print()
      for line in traceback.format_exception(exc_type, exc_value, exc_tb):
          print(colored(line, 'red'), end=' ')
  
      # Get the frame with the error.
      test_frame = sys._getframe(-1).f_back
  
      from ipdb.__main__ import wrap_sys_excepthook
      wrap_sys_excepthook()
      IPDBugger(exc_info=sys.exc_info()).set_trace(test_frame)
docs: Start a debugging session after catching an exception.
  
      This prints the traceback and start ipdb session in the frame of the error.