def nodes_from_path(G, path, key=''):
    """Helper to get list of node from a path with key"""
    if not key:
        return path
    else:
        keys = [G.node[node][key] for node in path]
        return keys