human
I wrote the below code

    if (source not in G):
        raise nx.NodeNotFound(('source    node    %s    not    in    graph' % source))
    if (target not in G):
        raise nx.NodeNotFound(('target    node    %s    not    in    graph' % target))
    if (weight is None):
        length_func = len
        shortest_path_func = _bidirectional_shortest_path
    else:
        def length_func(path):
            return sum((G.adj[u][v][weight] for (u, v) in zip(path, path[1:])))
        shortest_path_func = _bidirectional_dijkstra
    listA = list()
    listB = PathBuffer()
    prev_path = None
    while True:
        if (not prev_path):
            (length, path) = shortest_path_func(G, source, target, weight=weight)
            listB.push(length, path)
        else:
            ignore_nodes = set()
            ignore_edges = set()
            for i in range(1, len(prev_path)):
                root = prev_path[:i]
                root_length = length_func(root)
                for path in listA:
                    if (path[:i] == root):
                        ignore_edges.add((path[(i - 1)], path[i]))
                ignore_nodes.add(root[(-1)])
                try:
                    (length, spur) = shortest_path_func(G, root[(-1)], target, ignore_nodes=ignore_nodes, ignore_edges=ignore_edges, weight=weight)
                    path = (root[:(-1)] + spur)
                    listB.push((root_length + length), path)
                except nx.NetworkXNoPath:
                    pass
        if listB:
            path = listB.pop()
            (yield path)
            listA.append(path)
            prev_path = path
        else:
            break

What's a good function header?
assistant
#Here's a good function header.

@not_implemented_for('multigraph')
def shortest_simple_paths(G, source, target, weight=None):