def METHOD_NAME(_chain: HandlerChain, _context: RequestContext, _response: Response):
    # hack for legacy compatibility
    import flask.globals
    import quart.globals
    from localstack.utils.aws import request_context
    flask.globals._cv_request.reset(_context._legacy_flask_cv_request_token)
    quart.globals._cv_request.reset(_context._legacy_quart_cv_request_token)
    request_context.THREAD_LOCAL.request_context = None