def METHOD_NAME(assignments, hashval_counts=None):
    """
    For each hashval, count the LCA across its assignments.
    If hashval_counts is not None, it must be a dictionary that maps
    { hashval: hashval_count }; this is then used to weight the counts.
    """
    counts = Counter()
    for hashval in assignments:
        # for each list of tuple_info [(rank, name), ...] build
        # a tree that lets us discover lowest-common-ancestor.
        lineages = assignments[hashval]
        tree = build_tree(lineages)
        # now find either a leaf or the first node with multiple
        # children; that's our lowest-common-ancestor node.
        lca, reason = find_lca(tree)
        if hashval_counts:
            counts[lca] += hashval_counts[hashval]
        else:
            counts[lca] += 1
    return counts