def exitFilter(exit_fprint, cons_rel_stats, descriptors, fast, stable,
               internal, port):
    try:
        rel_stat = cons_rel_stats[exit_fprint]
        desc = descriptors[rel_stat.digest]
    except __HOLE__:
        return False

    if desc.ntor_onion_key is None:
        return False
    if Flag.BADEXIT in rel_stat.flags:
        return False
    if Flag.RUNNING not in rel_stat.flags:
        return False
    if Flag.VALID 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

    # we don't care about the exit policy if exit is for an internal circuit
    if internal is True:
        return True
    elif port is not None:
        return desc.exit_policy.can_exit_to(port=port)
    else:
        return desc.exit_policy.is_exiting_allowed
dataset/ETHPy150Open nskinkel/oppy/oppy/path/path.py/exitFilter