def nx_gen_edge_attrs(G, key, edges=None, default=util_const.NoParam,
                      on_missing='error', on_keyerr='default'):
    if on_missing is None:
        on_missing = 'error'
    if default is util_const.NoParam and on_keyerr == 'default':
        on_keyerr = 'error'
    if edges is None:
        if G.is_multigraph():
            raise NotImplementedError('')
        else:
            edges = G.edges()
    if on_missing == 'error':
        edge_data = (((u, v), G.adj[u][v]) for u, v in edges)
    elif on_missing == 'filter':
        edge_data = (((u, v), G.adj[u][v]) for u, v in edges if G.has_edge(u, v))
    elif on_missing == 'default':
        edge_data = (((u, v), G.adj[u][v])
                     if G.has_edge(u, v) else ((u, v), {})
                     for u, v in edges)
    else:
        raise KeyError('on_missing={}'.format(on_missing))
    if on_keyerr == 'error':
        edge_attrs = ((e, d[key]) for e, d in edge_data)
    elif on_keyerr == 'filter':
        edge_attrs = ((e, d[key]) for e, d in edge_data if key in d)
    elif on_keyerr == 'default':
        edge_attrs = ((e, d.get(key, default)) for e, d in edge_data)
    else:
        raise KeyError('on_keyerr={}'.format(on_keyerr))
    return edge_attrs