human
I wrote the below code

    def _dfs_cycle_forest(G, root=None):
        'Builds    a    directed    graph    composed    of    cycles    from    the    given    graph.\n\n                                `G`    is    an    undirected    simple    graph.    `root`    is    a    node    in    the    graph\n                                from    which    the    depth-first    search    is    started.\n\n                                This    function    returns    both    the    depth-first    search    cycle    graph\n                                (as    a    :class:`~networkx.DiGraph`)    and    the    list    of    nodes    in\n                                depth-first    preorder.    The    depth-first    search    cycle    graph    is    a\n                                directed    graph    whose    edges    are    the    edges    of    `G`    oriented    toward\n                                the    root    if    the    edge    is    a    tree    edge    and    away    from    the    root    if\n                                the    edge    is    a    non-tree    edge.    If    `root`    is    not    specified,    this\n                                performs    a    depth-first    search    on    each    connected    component    of    `G`\n                                and    returns    a    directed    forest    instead.\n\n                                If    `root`    is    not    in    the    graph,    this    raises    :exc:`KeyError`.\n\n                                '
        H = nx.DiGraph()
        nodes = []
        for (u, v, d) in nx.dfs_labeled_edges(G, source=root):
            if (d == 'forward'):
                if (u == v):
                    H.add_node(v, parent=None)
                    nodes.append(v)
                else:
                    H.add_node(v, parent=u)
                    H.add_edge(v, u, nontree=False)
                    nodes.append(v)
            elif ((d == 'nontree') and (v not in H[u])):
                H.add_edge(v, u, nontree=True)
            else:
               ...

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

@not_implemented_for('directed')
@not_implemented_for('multigraph')
def chain_decomposition(G, root=None):