'Execute a request through the request processing pipeline and
return the generated response.'

def invoke_request(self, request, _use_tweens=True):

    registry = self.registry
    has_listeners = registry.has_listeners
    notify = registry.notify
    if _use_tweens:
        handle_request = self.handle_request
    else:
        handle_request = self.orig_handle_request
    try:
        response = handle_request(request)
        if request.response_callbacks:
            request._process_response_callbacks(response)
        (has_listeners and notify(NewResponse(request, response)))
        return response
    finally:
        if request.finished_callbacks:
            request._process_finished_callbacks()
