<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def check_onfail_requisites(state_id, state_result, running, highstate):
    '''
    When a state fail and is part of a highstate, check
    if there is onfail requisites.
    When we find onfail requisites, we will consider the state failed
    only if at least one of those onfail requisites also failed

    Returns:

        True: if onfail handlers suceeded
        False: if one on those handler failed
        None: if the state does not have onfail requisites

    '''
    nret = None
    if (
        state_id and state_result and
        highstate and isinstance(highstate, dict)
    ):
        onfails = search_onfail_requisites(state_id, highstate)
        if onfails:
            for handler in onfails:
                fstate, mod_, fchunk = handler
                for rstateid, rstate in six.iteritems(running):
                    if '_|-' in rstateid:
                        st = salt.state.split_low_tag(rstateid)
                    # in case of simple state, try to guess
                    else:
                        id_ = rstate.get('__id__', rstateid)
                        if not id_:
                            raise ValueError('no state id')
                        st = {'__id__': id_, 'state': mod_}
                    if mod_ == st['state'] and fstate == st['__id__']:
                        ofresult = rstate.get('result', _empty)
                        if ofresult in [False, True]:
                            nret = ofresult
                        if ofresult is False:
                            # as soon as we find an errored onfail, we stop
                            break
                # consider that if we parsed onfailes without changing
                # the ret, that we have failed
                if nret is None:
                    nret = False
    return nret