code: def handle_exception(klass, exc, tb, coro=None):
      
      if coro is None:
          coro = compat.getcurrent()
  
      replacement = []
      for weak in state.local_exception_handlers.get(coro, ()):
          func = weak()
          if func is None:
              continue
  
          try:
              func(klass, exc, tb)
          except Exception:
              continue
  
          replacement.append(weak)
  
      if replacement:
          state.local_exception_handlers[coro][:] = replacement
  
      replacement = []
      for weak in state.global_exception_handlers:
          func = weak()
          if func is None:
              continue
  
          try:
              func(klass, exc, tb)
          except Exception:
              continue
  
          replacement.append(weak)
  
      state.global_exception_handlers[:] = replacement
docs: run all the registered exception handlers
  
      the first 3 arguments to this function match the output of
      ``sys.exc_info()``
  
      :param klass: the exception klass
      :type klass: type
      :param exc: the exception instance
      :type exc: Exception
      :param tb: the traceback object
      :type tb: Traceback
      :param coro:
          behave as though the exception occurred in this coroutine (defaults to
          the current coroutine)
      :type coro: greenlet
  
      exception handlers run would be all those added with
      :func:`global_exception_handler`, and any added for the relevant coroutine
      with :func:`local_exception_handler`.