code: def _node_type_from_group_spec(
      group_spec: Dict[str, Any], is_head: bool
  ) -> Dict[str, Any]:
      """Converts CR group spec to autoscaler node type."""
      if is_head:
          # The head node type has no workers because the head is not a worker.
          min_workers = max_workers = 0
      else:
          # `minReplicas` and `maxReplicas` are required fields for each workerGroupSpec
          min_workers = group_spec["minReplicas"]
          max_workers = group_spec["maxReplicas"]
  
      resources = _get_ray_resources_from_group_spec(
          group_spec, is_head
      )
  
      return {
          "min_workers": min_workers,
          "max_workers": max_workers,
          # `node_config` is a legacy field required for compatibility.
          # Pod config data is required by the operator but not by the autoscaler.
          "node_config": {},
          "resources": resources,
      }
  
imports: import decimal
  import json
  import logging
  import time
  from typing import Any, Dict, Optional
  import requests
  from ray.autoscaler._private.constants import DISABLE_LAUNCH_CONFIG_CHECK_KEY, DISABLE_NODE_UPDATERS_KEY, FOREGROUND_NODE_LAUNCH_KEY, WORKER_LIVENESS_CHECK_KEY, WORKER_RPC_DRAIN_KEY
  from ray.autoscaler._private.kuberay import node_provider, utils
  from ray.autoscaler._private.util import validate_config
label_desc: Use image node_id 5 for calling a global function with example usage: _node_type_from_group_spec(group_spec, is_head) and returns: dict