code: def assert_cluster_resource_constraints(
      state: ClusterResourceState,
      expected_bundles: List[dict],
      expected_count: List[int],
  ):
      """
      Assert a GetClusterResourceStateReply has cluster_resource_constraints that
      matches with the expected resources.
      """
      # We only have 1 constraint for now.
      assert len(state.cluster_resource_constraints) == 1
  
      min_bundles = state.cluster_resource_constraints[0].min_bundles
      assert (
          len(min_bundles)
          == len(expected_bundles)
          == len(expected_count)
      )
  
      # Sort all the bundles by bundle's resource names
      min_bundles = sorted(
          min_bundles,
          key=lambda bundle_by_count: "".join(
              bundle_by_count.request.resources_bundle.keys()
          ),
      )
      expected = zip(expected_bundles, expected_count)
      expected = sorted(
          expected,
          key=lambda bundle_count: "".join(bundle_count[0].keys()),
      )
  
      for actual_bundle_count, expected_bundle_count in zip(
          min_bundles, expected
      ):
          assert (
              dict(actual_bundle_count.request.resources_bundle)
              == expected_bundle_count[0]
          )
          assert actual_bundle_count.count == expected_bundle_count[1]
  
imports: import os
  import sys
  import time
  from dataclasses import dataclass
  from typing import Callable, List, Optional, Tuple
  import pytest
  import ray
  import ray._private.ray_constants
  from ray._private.test_utils import wait_for_condition
  from ray.autoscaler.v2.schema import ClusterStatus, LaunchRequest, NodeInfo, ResourceRequestByCount
  from ray.autoscaler.v2.sdk import get_cluster_status, request_cluster_resources
  from ray.autoscaler.v2.tests.util import get_available_resources, get_cluster_resource_state, get_total_resources, report_autoscaling_state
  from ray.core.generated import autoscaler_pb2, autoscaler_pb2_grpc
  from ray.core.generated.autoscaler_pb2 import ClusterResourceState, NodeStatus
  from ray.util.state.api import list_nodes
label_desc: Use image node_id 3 for calling a global function with example usage: assert_cluster_resource_constraints(state, expected_bundles, expected_count) without return types