code: def _get_num_cpus(
      ray_start_params: Dict[str, str],
      k8s_resource_limits: Dict[str, str],
      group_name: str,
  ) -> int:
      """Get CPU annotation from ray_start_params or k8s_resource_limits,
      with priority for ray_start_params.
      """
      if "num-cpus" in ray_start_params:
          return int(ray_start_params["num-cpus"])
      elif "cpu" in k8s_resource_limits:
          cpu_quantity: str = k8s_resource_limits["cpu"]
          return _round_up_k8s_quantity(cpu_quantity)
      else:
          # Getting the number of CPUs is important, so raise an error if we can't do it.
          raise ValueError(
              f"Autoscaler failed to detect `CPU` resources for group {group_name}."
              "\nSet the `--num-cpus` rayStartParam and/or "
              "the CPU resource limit for the Ray container."
          )
  
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 7 for calling a global function with example usage: _get_num_cpus(ray_start_params, k8s_resource_limits, group_name) and returns: int, _round_up_k8s_quantity