def nx_gen_node_attrs(G, key, nodes=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 nodes is None:
        nodes = G.nodes()
    node_dict = nx_node_dict(G)
    if on_missing == 'error':
        node_data = ((n, node_dict[n]) for n in nodes)
    elif on_missing == 'filter':
        node_data = ((n, node_dict[n]) for n in nodes if n in G)
    elif on_missing == 'default':
        node_data = ((n, node_dict.get(n, {})) for n in nodes)
    else:
        raise KeyError('on_missing={} must be error, filter or default'.format(
            on_missing))
    if on_keyerr == 'error':
        node_attrs = ((n, d[key]) for n, d in node_data)
    elif on_keyerr == 'filter':
        node_attrs = ((n, d[key]) for n, d in node_data if key in d)
    elif on_keyerr == 'default':
        node_attrs = ((n, d.get(key, default)) for n, d in node_data)
    else:
        raise KeyError('on_keyerr={} must be error filter or default'.format(on_keyerr))
    return node_attrs