code: def _get_memory(
      ray_start_params: Dict[str, str],
      k8s_resource_limits: Dict[str, Any],
  ) -> Optional[int]:
      """Get memory resource annotation from ray_start_params or k8s_resource_limits,
      with priority for ray_start_params.
      """
      if "memory" in ray_start_params:
          return int(ray_start_params["memory"])
      elif "memory" in k8s_resource_limits:
          memory_quantity: str = k8s_resource_limits["memory"]
          return _round_up_k8s_quantity(memory_quantity)
      return None
  
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 8 for calling a global function with example usage: _get_memory(ray_start_params, k8s_resource_limits) and returns: None, int, _round_up_k8s_quantity