def METHOD_NAME(
    self,
    root: InferenceSignalNode,
    output_weights: Dict[InferenceSignalNode, int],
    output_parent_only_weights: Dict[InferenceSignalNode, int],
    signals_by_type: Dict[InferenceSignalNode, List[InferenceSignal]],
) -> Dict[InferenceSignalNode, int]:
    """Get a dict of cumulative weights, starting at `root`.
    A parent node's weight is the sum of all its children plus its own weight. Children tagged as only
    applying to their parent are excluded from their grand-parent's sum.
    root: the root to start assigning cumulative weights from.
    output_weights: the output dictionary to assign the cumulative weights to
    output_parent_only_weights: similar to output_weights, but the weight of each node excludes the weights
        of all of its parent-only children
    signals_by_type: a dictionary that maps signal type nodes to signals
    """
    for child in root.children:
        self.METHOD_NAME(
            root=child,
            output_weights=output_weights,
            output_parent_only_weights=output_parent_only_weights,
            signals_by_type=signals_by_type,
        )
    output_weights[root] = sum(self._weighter_function(signal.confidence) for signal in signals_by_type[root])
    output_weights[root] += sum(output_parent_only_weights[child] for child in root.children)
    output_parent_only_weights[root] = sum(
        self._weighter_function(signal.confidence)
        for signal in signals_by_type[root]
        if not signal.only_applies_to_parent
    )
    return output_weights