def validate_handler_overrides(process_class, handler_overrides, ctx):  # pylint: disable=inconsistent-return-statements,unused-argument
    """Validator for the `handler_overrides` input port of the `BaseRestartWorkChain.

    The `handler_overrides` should be a dictionary where keys are strings that are the name of a process handler, i.e. a
    instance method of the `process_class` that has been decorated with the `process_handler` decorator. The values
    should be boolean.

    .. note:: the normal signature of a port validator is `(value, ctx)` but since for the validation here we need a
        reference to the process class, we add it and the class is bound to the method in the port declaration in the
        `define` method.

    :param process_class: the `BaseRestartWorkChain` (sub) class
    :param handler_overrides: the input `Dict` node
    :param ctx: the `PortNamespace` in which the port is embedded
    """
    if not handler_overrides:
        return

    for handler, override in handler_overrides.get_dict().items():
        if not isinstance(handler, str):
            return 'The key `{}` is not a string.'.format(handler)

        if not process_class.is_process_handler(handler):
            return 'The key `{}` is not a process handler of {}'.format(handler, process_class)

        if not isinstance(override, bool):
            return 'The value of key `{}` is not a boolean.'.format(handler)