code: def check_placement_group_index(
      placement_group: PlacementGroup, bundle_index: int
  ) -> None:
      assert placement_group is not None
      if placement_group.id.is_nil():
          if bundle_index != -1:
              raise ValueError(
                  "If placement group is not set, "
                  "the value of bundle index must be -1."
              )
      elif (
          bundle_index >= placement_group.bundle_count
          or bundle_index < -1
      ):
          raise ValueError(
              f"placement group bundle index {bundle_index} "
              f"is invalid. Valid placement group indexes: "
              f"0-{placement_group.bundle_count}"
          )
  
imports: import warnings
  from typing import Dict, List, Optional, Union
  import ray
  from ray._private.auto_init_hook import auto_init_ray
  from ray._private.client_mode_hook import client_mode_should_convert, client_mode_wrap
  from ray._private.utils import hex_to_binary, get_ray_doc_version
  from ray._raylet import PlacementGroupID
  from ray.util.annotations import DeveloperAPI, PublicAPI
  from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy
label_desc: Use image node_id 9 for calling a global function with example usage: check_placement_group_index(placement_group, bundle_index) without return types