def METHOD_NAME():
    in_context = False
    factory_called = False
    @contextlib.contextmanager
    def context():
        nonlocal in_context
        old, in_context = in_context, True
        yield
        in_context = old
    def factory(_):
        nonlocal factory_called
        factory_called = True
        return context()
    with _register_nested_context_factory(factory):
        assert not factory_called
        assert not in_context
        with dpctl.device_context("opencl:cpu:0"):
            assert factory_called
            assert in_context
        assert not in_context