def METHOD_NAME(handler, registry):
    def compression_tween(request):
        response = handler(request)
        # We use a response callback here so that it happens after all of the
        # other response callbacks are called. This is important because
        # otherwise we won't be able to check Vary headers and such that are
        # set by response callbacks.
        request.add_response_callback(_compressor)
        return response
    return compression_tween