def reverse_dag_parsing(
        cls, metric_node: Metric, manifest: Manifest, metric_depth_count: int
    ) -> Iterator[Dict[str, int]]:
        """For the given metric, yeilds dictionaries having {<metric_name>: <depth_from_initial_metric} of upstream derived metrics.

        This function is intended as a helper function for other metric helper functions.
        """
        if metric_node.type in DERIVED_METRICS:
            yield {metric_node.name: metric_depth_count}

            for parent_unique_id in metric_node.depends_on.nodes:
                node = manifest.expect(parent_unique_id)
                if isinstance(node, Metric):
                    yield from cls.reverse_dag_parsing(node, manifest, metric_depth_count + 1)
For the given metric, yeilds dictionaries having {<metric_name>: <depth_from_initial_metric} of upstream derived metrics.

        This function is intended as a helper function for other metric helper functions.
        
core/dbt/contracts/graph/metrics.py