human
I wrote the below code

    def redundancy(G, u, v, weight=None):
        nmw = normalized_mutual_weight
        r = sum(((nmw(G, u, w, weight=weight) * nmw(G, v, w, norm=max, weight=weight)) for w in set(nx.all_neighbors(G, u))))
        return (1 - r)
    effective_size = {}
    if (nodes is None):
        nodes = G
    if ((not G.is_directed()) and (weight is None)):
        for v in G:
            if (len(G[v]) == 0):
                effective_size[v] = float('nan')
                continue
            E = nx.ego_graph(G, v, center=False, undirected=True)
            effective_size[v] = (len(E) - ((2 * E.size()) / len(E)))
    else:
        for v in G:
            if (len(G[v]) == 0):
                effective_size[v] = float('nan')
                continue
            effective_size[v] = sum((redundancy(G, v, u, weight) for u in set(nx.all_neighbors(G, v))))
    return effective_size

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

def effective_size(G, nodes=None, weight=None):