code: def _get_custom_resources(
      ray_start_params: Dict[str, Any], group_name: str
  ) -> Dict[str, int]:
      """Format custom resources based on the `resources` Ray start param.
  
      Currently, the value of the `resources` field must
      be formatted as follows:
      '"{\"Custom1\": 1, \"Custom2\": 5}"'.
  
      This method first converts the input to a correctly formatted
      json string and then loads that json string to a dict.
      """
      if "resources" not in ray_start_params:
          return {}
      resources_string = ray_start_params["resources"]
      try:
          # Drop the extra pair of quotes and remove the backslash escapes.
          # resources_json should be a json string.
          resources_json = resources_string[1:-1].replace("\\", "")
          # Load a dict from the json string.
          resources = json.loads(resources_json)
          assert isinstance(resources, dict)
          for key, value in resources.items():
              assert isinstance(key, str)
              assert isinstance(value, int)
      except Exception as e:
          logger.error(
              f"Error reading `resource` rayStartParam for group {group_name}."
              " For the correct format, refer to example configuration at "
              "https://github.com/ray-project/ray/blob/master/python/"
              "ray/autoscaler/kuberay/ray-cluster.complete.yaml."
          )
          raise e
      return 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 11 for calling a global function with example usage: _get_custom_resources(ray_start_params, group_name) and returns: resources, dict