def METHOD_NAME(plugin_registry):
    recorder = []
    class LastPlugin:
        @hookimpl(trylast=True)
        def get_a_joke(self, number: int):
            recorder.append("last")
            return "last joke"
    class MiddlePlugin:
        @hookimpl(hookwrapper=True)
        def get_a_joke(self, number: int):
            recorder.append("before")
            yield
            recorder.append("after")
    class FirstPlugin:
        @hookimpl(tryfirst=True)
        def get_a_joke(self, number: int):
            recorder.append("first")
            raise Exception("")
    plugin_registry.load_plugin_with_hooks_impl(FirstPlugin(), "first")
    plugin_registry.load_plugin_with_hooks_impl(MiddlePlugin(), "middle")
    plugin_registry.load_plugin_with_hooks_impl(LastPlugin(), "last")
    with pytest.raises(Exception):
        plugin_registry.hook().get_a_joke(number=1)
    assert recorder == ["before", "first", "after"]