def METHOD_NAME(request, manager):
    METHOD_NAME = Watcher().register(manager)
    def finalizer():
        waiter = WaitEvent(manager, "unregistered")
        METHOD_NAME.unregister()
        waiter.wait()
    request.addfinalizer(finalizer)
    return METHOD_NAME