def select_edges_by_relationship(graph, edge_filter = [], remove = False):
    """
    Filters the edges of a graph.

    Parameters
        graph: Graph to filter
        edge_filter: List of edge relationships to filter on
        remove: whether to remove the selected Edges (optional, default: False) 

    Returns a filtered graph.
    """
    working_graph = graph.copy()
    for edge_id in graph.edges:
        value = working_graph.edges()[edge_id].get('relationship')
        if remove:
            if value in edge_filter:
                working_graph.remove_edge(edge_id[0], edge_id[1])
        else:
            if not value in edge_filter:
                working_graph.remove_edge(edge_id[0], edge_id[1])
    return working_graph