code: def tasks_by_state(info) -> dict:
      return tasks_breakdown(info, lambda s: s.labels["State"])
  
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 1 for calling a global function with example usage: tasks_by_state(info) and returns: tasks_breakdown