human
I wrote the below code

    forest = UnionFind(G)
    def best_edge(component):
        'Returns    the    optimum    (minimum    or    maximum)    edge    on    the    edge\n                                boundary    of    the    given    set    of    nodes.\n\n                                A    return    value    of    ``None``    indicates    an    empty    boundary.\n\n                                '
        sign = (1 if minimum else (-1))
        minwt = float('inf')
        boundary = None
        for e in nx.edge_boundary(G, component, data=True):
            wt = (e[(-1)].get(weight, 1) * sign)
            if isnan(wt):
                if ignore_nan:
                    continue
                msg = 'NaN    found    as    an    edge    weight.    Edge    %s'
                raise ValueError((msg % (e,)))
            if (wt < minwt):
                minwt = wt
                boundary = e
        return boundary
    best_edges = (best_edge(component) for component in forest.to_sets())
    best_edges = [edge for edge in best_edges if (edge is not None)]
    while best_edges:
        best_edges = (best_edge(component) for component in forest.to_sets())
        best_edges = [edge for edge in best_edges if (edge is not None)]
        for (u, v, d) in best_edges:
            if (forest[u] != forest[v]):
                if data:
                    (yield (u, v, d))
                else:
                    (yield (u, v))
                forest.union(u, v)

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

@not_implemented_for('multigraph')
def boruvka_mst_edges(G, minimum=True, weight='weight', keys=False, data=True, ignore_nan=False):