def prefilter_by_attractor(networks, attractors, partial=True):
    """
    DESCRIPTION:
    A function to filter boolean networks based on if they hold certain
    attractors or not.
    :param networks: [list] boolean networks (dict) to filter based on
    their attractors.
    :param attractors: [list] attractors (str) to filter the networks.
    :param partial: [bool] flag to indicate if the condition should be 
    relaxed. If partial == True, then it will be enough for the network
    to show just one attractor from the list to pass the filter. If False
    the network will need to show all the attractors in the list.
    """
    # Helper functions
    def check_node(node_index, nodes, attractor, network):
        node = nodes[node_index]
        # Check if the attractor value is 1 or 0
        if int(attractor[node_index]):
            result = attractor in network['network'][node]
        else:
            result = attractor not in network['network'][node]
        return result

    # Iterate over every network
    nodes = list(networks[0]['network'].keys())
    for network in networks:
        # Network might be a None resulting from unsuccessful conflict solving
        if network is not None:
            attractor_conditions = []
            # Check every attractor
            for attractor in attractors:
                node_conditions = [check_node(node_index, nodes, attractor, network) 
                    for node_index in range(len(nodes))]
                attractor_conditions.append(all(node_conditions))
            if all(attractor_conditions) or partial and any(attractor_conditions):
                yield network