get all edges with the given edge type and layer.

    Parameters
    ----------
    docgraph : DiscourseDocumentGraph
        document graph from which the nodes will be extracted
    layer : str
        name of the layer
    edge_type : str
        Type of the edges to be extracted (Edge types are defined in the
        Enum ``EdgeTypes``).
    data : bool
        If True, results will include edge attributes.

    Returns
    -------
    edges : generator of str
        a container/list of edges (represented as (source node ID, target
        node ID) tuples). If data is True, edges are represented as
        (source node ID, target node ID, edge attribute dict) tuples.

def select_edges_by(docgraph, layer=None, edge_type=None, data=False):
    """
    get all edges with the given edge type and layer.

    Parameters
    ----------
    docgraph : DiscourseDocumentGraph
        document graph from which the nodes will be extracted
    layer : str
        name of the layer
    edge_type : str
        Type of the edges to be extracted (Edge types are defined in the
        Enum ``EdgeTypes``).
    data : bool
        If True, results will include edge attributes.

    Returns
    -------
    edges : generator of str
        a container/list of edges (represented as (source node ID, target
        node ID) tuples). If data is True, edges are represented as
        (source node ID, target node ID, edge attribute dict) tuples.
    """
    edge_type_eval = "edge_attribs['edge_type'] == '{}'".format(edge_type)
    layer_eval = "'{}' in edge_attribs['layers']".format(layer)

    if layer is not None:
        if edge_type is not None:
            return select_edges(docgraph, data=data,
                                conditions=[edge_type_eval, layer_eval])
        else:  # filter by layer, but not by edge type
            return select_edges(docgraph, conditions=[layer_eval], data=data)

    else:  # don't filter layers
        if edge_type is not None:  # filter by edge type, but not by layer
            return select_edges(docgraph, data=data,
                                conditions=[edge_type_eval])
        else:  # neither layer, nor edge type is filtered
            return docgraph.edges_iter(data=data)