code: async def finalize_request(
          self,
          result: ResponseReturnValue,
          request_context: Optional[RequestContext]=None,
          from_error_handler: bool=False,
      ) -> Response:
          
          response = await self.make_response(result)
          try:
              response = await self.process_response(response, request_context)
              await request_finished.send(self, response=response)
          except Exception:
              if not from_error_handler:
                  raise
              self.logger.exception('Request finalizing errored')
          return response
docs: Turns the view response return value into a response.
  
          Arguments:
              result: The result of the request to finalize into a response.
              request_context: The request context, optional as Flask
                  omits this argument.