code: def assert_gang_requests(
      state: ClusterResourceState, expected: List[GangResourceRequest]
  ):
      """
      Assert a GetClusterResourceStateReply has gang requests that
      matches with the expected requests.
      """
      assert len(state.pending_gang_resource_requests) == len(expected)
  
      # Sort all the requests by request's details
      requests = sorted(
          state.pending_gang_resource_requests,
          key=lambda request: request.details,
      )
      expected = sorted(
          expected, key=lambda request: "".join(request.details)
      )
  
      for actual_request, expected_request in zip(requests, expected):
          # Assert the detail contains the expected details
          for detail_str in expected_request.details:
              assert detail_str in actual_request.details
  
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 7 for calling a global function with example usage: assert_gang_requests(state, expected) without return types