code: def _audit_request(options, func, request_context, *args, **kwargs):  # noqa: C901
      
      logger = getLogger("audit")
  
      request_info = RequestInfo(options, func, request_context)
      response = None
  
      request_info.capture_request()
      try:
          # process the request
          with elapsed_time(request_info.timing):
              response = func(*args, **kwargs)
      except Exception as error:
          request_info.capture_error(error)
          raise
      else:
          request_info.capture_response(response)
          return response
      finally:
          if not should_skip_logging(func):
              request_info.log(logger)
docs: Run a request function under audit.