def METHOD_NAME(handler, registry):
    def content_security_policy_tween(request):
        resp = handler(request)
        try:
            policy = request.find_service(name="csp")
        except LookupError:
            policy = collections.defaultdict(list)
        # Replace CSP headers on /simple/ pages.
        if request.path.startswith("/simple/"):
            policy = collections.defaultdict(list)
            policy["sandbox"] = ["allow-top-navigation"]
            policy["default-src"] = [NONE]
        # We don't want to apply our Content Security Policy to the debug
        # toolbar, that's not part of our application and it doesn't work with
        # our restrictive CSP.
        policy = _serialize(policy).format(request=request)
        if not request.path.startswith("/_debug_toolbar/") and policy:
            resp.headers["Content-Security-Policy"] = policy
        return resp
    return content_security_policy_tween