code: def assert_launches(
      cluster_status: ClusterStatus,
      expected_pending_launches: List[LaunchRequest],
      expected_failed_launches: List[LaunchRequest],
  ):
      def assert_launches(actuals, expects):
          for actual, expect in zip(actuals, expects):
              assert (
                  actual.instance_type_name == expect.instance_type_name
              )
              assert (
                  actual.ray_node_type_name == expect.ray_node_type_name
              )
              assert actual.count == expect.count
              assert actual.state == expect.state
              assert actual.request_ts_s == expect.request_ts_s
  
      assert len(cluster_status.pending_launches) == len(
          expected_pending_launches
      )
      assert len(cluster_status.failed_launches) == len(
          expected_failed_launches
      )
  
      actual_pending = sorted(
          cluster_status.pending_launches,
          key=lambda launch: launch.ray_node_type_name,
      )
      expected_pending = sorted(
          expected_pending_launches,
          key=lambda launch: launch.ray_node_type_name,
      )
  
      assert_launches(actual_pending, expected_pending)
  
      actual_failed = sorted(
          cluster_status.failed_launches,
          key=lambda launch: launch.ray_node_type_name,
      )
      expected_failed = sorted(
          expected_failed_launches,
          key=lambda launch: launch.ray_node_type_name,
      )
  
      assert_launches(actual_failed, expected_failed)
  
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 6 for calling a global function with example usage: assert_launches(cluster_status, expected_pending_launches, expected_failed_launches) without return types