code: async def do_teardown_request(
              self,
              exc: Optional[BaseException],
              request_context: Optional[RequestContext]=None,
      ) -> None:
          
          request_ = (request_context or _request_ctx_stack.top).request
          functions = self.teardown_request_funcs[None]
          blueprint = request_.blueprint
          if blueprint is not None:
              functions = chain(functions, self.teardown_request_funcs[blueprint])  # type: ignore
  
          for function in functions:
              await function(exc=exc)
          await request_tearing_down.send(self, exc=exc)
docs: Teardown the request, calling the teardown functions.
  
          Arguments:
              exc: Any exception not handled that has caused the request
                  to teardown.
              request_context: The request context, optional as Flask
                  omits this argument.