code: def placement_groups_to_resource_demands(
      pending_placement_groups: List[PlacementGroupTableData],
  ):
      """Preprocess placement group requests into regular resource demand vectors
      when possible. The policy is:
          * STRICT_PACK - Convert to a single bundle.
          * PACK - Flatten into a resource demand vector.
          * STRICT_SPREAD - Cannot be converted.
          * SPREAD - Flatten into a resource demand vector.
  
      Args:
          pending_placement_groups (List[PlacementGroupData]): List of
          PlacementGroupLoad's.
  
      Returns:
          List[ResourceDict]: The placement groups which were converted to a
              resource demand vector.
          List[List[ResourceDict]]: The placement groups which should be strictly
              spread.
      """
      resource_demand_vector = []
      unconverted = []
      for placement_group in pending_placement_groups:
          shapes = [
              dict(bundle.unit_resources)
              for bundle in placement_group.bundles
          ]
          if (
              placement_group.strategy == PlacementStrategy.PACK
              or placement_group.strategy == PlacementStrategy.SPREAD
          ):
              resource_demand_vector.extend(shapes)
          elif (
              placement_group.strategy == PlacementStrategy.STRICT_PACK
          ):
              combined = collections.defaultdict(float)
              for shape in shapes:
                  for label, quantity in shape.items():
                      combined[label] += quantity
              resource_demand_vector.append(combined)
          elif (
              placement_group.strategy
              == PlacementStrategy.STRICT_SPREAD
          ):
              unconverted.append(shapes)
          else:
              logger.error(
                  f"Unknown placement group request type: {placement_group}. "
                  f"Please file a bug report "
                  f"https://github.com/ray-project/ray/issues/new."
              )
      return resource_demand_vector, unconverted
  
imports: import collections
  import copy
  import logging
  import os
  from abc import abstractmethod
  from functools import partial
  from typing import Callable, Dict, List, Optional, Tuple
  import ray
  from ray._private.gcs_utils import PlacementGroupTableData
  from ray.autoscaler._private.constants import AUTOSCALER_CONSERVE_GPU_NODES, AUTOSCALER_UTILIZATION_SCORER_KEY
  from ray.autoscaler._private.loader import load_function_or_class
  from ray.autoscaler._private.node_provider_availability_tracker import NodeAvailabilitySummary
  from ray.autoscaler._private.util import NodeID, NodeIP, NodeType, NodeTypeConfigDict, ResourceDict, is_placement_group_resource
  from ray.autoscaler.node_provider import NodeProvider
  from ray.autoscaler.tags import NODE_KIND_HEAD, NODE_KIND_UNMANAGED, NODE_KIND_WORKER, TAG_RAY_NODE_KIND, TAG_RAY_USER_NODE_TYPE
  from ray.core.generated.common_pb2 import PlacementStrategy
label_desc: Use image node_id 10 for calling a global function with example usage: placement_groups_to_resource_demands(pending_placement_groups) and returns: resource_demand_vector,  unconverted