code: def status_tag(pod: Dict[str, Any]) -> NodeStatus:
      """Convert pod state to Ray autoscaler node status.
  
      See the doc string of the class
      batching_node_provider.NodeData for the semantics of node status.
      """
      if (
          "containerStatuses" not in pod["status"]
          or not pod["status"]["containerStatuses"]
      ):
          return "pending"
  
      state = pod["status"]["containerStatuses"][0]["state"]
  
      if "pending" in state:
          return "pending"
      if "running" in state:
          return STATUS_UP_TO_DATE
      if "waiting" in state:
          return "waiting"
      if "terminated" in state:
          return STATUS_UPDATE_FAILED
      raise ValueError("Unexpected container state.")
  
imports: import json
  import logging
  import os
  from collections import defaultdict
  from typing import Any, Dict, List, Optional, Tuple
  import requests
  from ray.autoscaler._private.constants import WORKER_LIVENESS_CHECK_KEY, WORKER_RPC_DRAIN_KEY
  from ray.autoscaler._private.util import NodeID, NodeIP, NodeKind, NodeStatus, NodeType
  from ray.autoscaler.batching_node_provider import BatchingNodeProvider, NodeData, ScaleRequest
  from ray.autoscaler.tags import NODE_KIND_HEAD, NODE_KIND_WORKER, STATUS_UP_TO_DATE, STATUS_UPDATE_FAILED, TAG_RAY_USER_NODE_TYPE
label_desc: Use image node_id 4 for calling a global function with example usage: status_tag(pod) and returns: str, str, STATUS_UP_TO_DATE, str, STATUS_UPDATE_FAILED