Removes an attributes from specific edges in the graph

    Doctest:
        >>> from utool.util_graph import *  # NOQA
        >>> import utool as ut
        >>> G = nx.karate_club_graph()
        >>> nx.set_edge_attributes(G, name='spam', values='eggs')
        >>> nx.set_edge_attributes(G, name='foo', values='bar')
        >>> assert len(nx.get_edge_attributes(G, 'spam')) == 78
        >>> assert len(nx.get_edge_attributes(G, 'foo')) == 78
        >>> ut.nx_delete_edge_attr(G, ['spam', 'foo'], edges=[(1, 2)])
        >>> assert len(nx.get_edge_attributes(G, 'spam')) == 77
        >>> assert len(nx.get_edge_attributes(G, 'foo')) == 77
        >>> ut.nx_delete_edge_attr(G, ['spam'])
        >>> assert len(nx.get_edge_attributes(G, 'spam')) == 0
        >>> assert len(nx.get_edge_attributes(G, 'foo')) == 77

    Doctest:
        >>> from utool.util_graph import *  # NOQA
        >>> import utool as ut
        >>> G = nx.MultiGraph()
        >>> G.add_edges_from([(1, 2), (2, 3), (3, 4), (4, 5), (4, 5), (1, 2)])
        >>> nx.set_edge_attributes(G, name='spam', values='eggs')
        >>> nx.set_edge_attributes(G, name='foo', values='bar')
        >>> assert len(nx.get_edge_attributes(G, 'spam')) == 6
        >>> assert len(nx.get_edge_attributes(G, 'foo')) == 6
        >>> ut.nx_delete_edge_attr(G, ['spam', 'foo'], edges=[(1, 2, 0)])
        >>> assert len(nx.get_edge_attributes(G, 'spam')) == 5
        >>> assert len(nx.get_edge_attributes(G, 'foo')) == 5
        >>> ut.nx_delete_edge_attr(G, ['spam'])
        >>> assert len(nx.get_edge_attributes(G, 'spam')) == 0
        >>> assert len(nx.get_edge_attributes(G, 'foo')) == 5

def nx_delete_edge_attr(graph, name, edges=None):
    """
    Removes an attributes from specific edges in the graph

    Doctest:
        >>> from utool.util_graph import *  # NOQA
        >>> import utool as ut
        >>> G = nx.karate_club_graph()
        >>> nx.set_edge_attributes(G, name='spam', values='eggs')
        >>> nx.set_edge_attributes(G, name='foo', values='bar')
        >>> assert len(nx.get_edge_attributes(G, 'spam')) == 78
        >>> assert len(nx.get_edge_attributes(G, 'foo')) == 78
        >>> ut.nx_delete_edge_attr(G, ['spam', 'foo'], edges=[(1, 2)])
        >>> assert len(nx.get_edge_attributes(G, 'spam')) == 77
        >>> assert len(nx.get_edge_attributes(G, 'foo')) == 77
        >>> ut.nx_delete_edge_attr(G, ['spam'])
        >>> assert len(nx.get_edge_attributes(G, 'spam')) == 0
        >>> assert len(nx.get_edge_attributes(G, 'foo')) == 77

    Doctest:
        >>> from utool.util_graph import *  # NOQA
        >>> import utool as ut
        >>> G = nx.MultiGraph()
        >>> G.add_edges_from([(1, 2), (2, 3), (3, 4), (4, 5), (4, 5), (1, 2)])
        >>> nx.set_edge_attributes(G, name='spam', values='eggs')
        >>> nx.set_edge_attributes(G, name='foo', values='bar')
        >>> assert len(nx.get_edge_attributes(G, 'spam')) == 6
        >>> assert len(nx.get_edge_attributes(G, 'foo')) == 6
        >>> ut.nx_delete_edge_attr(G, ['spam', 'foo'], edges=[(1, 2, 0)])
        >>> assert len(nx.get_edge_attributes(G, 'spam')) == 5
        >>> assert len(nx.get_edge_attributes(G, 'foo')) == 5
        >>> ut.nx_delete_edge_attr(G, ['spam'])
        >>> assert len(nx.get_edge_attributes(G, 'spam')) == 0
        >>> assert len(nx.get_edge_attributes(G, 'foo')) == 5
    """
    removed = 0
    keys = [name] if not isinstance(name, (list, tuple)) else name
    if edges is None:
        if graph.is_multigraph():
            edges = graph.edges(keys=True)
        else:
            edges = graph.edges()
    if graph.is_multigraph():
        for u, v, k in edges:
            for key_ in keys:
                try:
                    del graph[u][v][k][key_]
                    removed += 1
                except KeyError:
                    pass
    else:
        for u, v in edges:
            for key_ in keys:
                try:
                    del graph[u][v][key_]
                    removed += 1
                except KeyError:
                    pass
    return removed