def METHOD_NAME(wrapped, instance, args, kwargs):
    # When the handler will be called by the `BaseRestartWorkChain` it will pass the node as the only argument
    node = args[0]
    if exit_codes is not None and node.exit_status not in [
        exit_code.status for exit_code in exit_codes  # type: ignore[union-attr]
    ]:
        result = None
    else:
        result = wrapped(*args, **kwargs)
    # Append the name and return value of the current process handler to the `considered_handlers` extra.
    try:
        considered_handlers = instance.node.base.extras.get(instance._considered_handlers_extra, [])  # pylint: disable=protected-access
        current_process = considered_handlers[-1]
    except IndexError:
        # The extra was never initialized, so we skip this functionality
        pass
    else:
        # Append the name of the handler to the last list in `considered_handlers` and save it
        serialized = result
        if isinstance(serialized, ProcessHandlerReport):
            serialized = {'do_break': serialized.do_break, 'exit_status': serialized.exit_code.status}
        current_process.append((wrapped.__name__, serialized))
        instance.node.base.extras.set(instance._considered_handlers_extra, considered_handlers)  # pylint: disable=protected-access
    return result