code: def log_exception(func, handler, args, kwargs):
      
      # safe-guard: expected arguments -> log_exception(self, typ, value, tb)
      value = args[1] if len(args) == 3 else None
      if value is None:
          return func(*args, **kwargs)
  
      tracing = handler.settings.get('opentracing_tracing')
      if not isinstance(value, HTTPError) or 500 <= value.status_code <= 599:
          tracing._finish_tracing(handler, error=value)
  
      return func(*args, **kwargs)
docs: Wrap the handler ``log_exception`` method to finish the Span for the
      given request, if available. This method is called when an Exception
      is not handled in the user code.