def middleFilter(node, cons_rel_stats, descriptors, exit_desc,
                 exit_status_entry, guard_desc, guard_status_entry,
                 fast=False, stable=False):
    try:
        rel_stat = cons_rel_stats[node]
        node_desc = descriptors[rel_stat.digest]
    except __HOLE__:
        return False

    if node_desc.ntor_onion_key is None:
        return False
    # Note that we intentionally allow non-Valid routers for middle
    # as per path-spec.txt default config
    if Flag.RUNNING not in rel_stat.flags:
        return False
    if (fast is True) and (Flag.FAST not in rel_stat.flags):
        return False
    if (stable is True) and (Flag.STABLE not in rel_stat.flags):
        return False
    if path_util.nodeUsableWithOther(exit_desc, exit_status_entry, node_desc,
        rel_stat) is False:
        return False

    return path_util.nodeUsableWithOther(guard_desc, guard_status_entry,
                                         node_desc, rel_stat)
dataset/ETHPy150Open nskinkel/oppy/oppy/path/path.py/middleFilter