code: def tasks_breakdown(info, key_fn) -> dict:
      res = raw_metrics(info)
      if "ray_tasks" in res:
          breakdown = defaultdict(int)
          for sample in res["ray_tasks"]:
              key = key_fn(sample)
              breakdown[key] += sample.value
              if breakdown[key] == 0:
                  del breakdown[key]
          print("Task label breakdown: {}".format(breakdown))
          return breakdown
      else:
          return {}
  
imports: from collections import defaultdict
  import sys
  import os
  import copy
  import pytest
  import ray
  from ray._private.metrics_agent import RAY_WORKER_TIMEOUT_S
  from ray._private.test_utils import raw_metrics, run_string_as_driver, run_string_as_driver_nonblocking, wait_for_condition
label_desc: Use image node_id 4 for calling a global function with example usage: tasks_breakdown(info, key_fn) and returns: breakdown, dict