code: def get_metadata(key):
      import requests  # pytype: disable=import-error
      import time  # pytype: disable=import-error
  
      # Based on https://github.com/tensorflow/tensorflow/pull/40317
      gce_metadata_endpoint = "http://" + os.environ.get(
          "GCE_METADATA_IP", "metadata.google.internal"
      )
  
      retry_count = 0
      retrySeconds = 0.500
      api_resp = None
  
      while retry_count < 6:
          api_resp = requests.get(
              f"{gce_metadata_endpoint}/computeMetadata/v1/instance/attributes/{key}",
              headers={"Metadata-Flavor": "Google"},
          )
          if api_resp.status_code == 200:
              break
          retry_count += 1
          time.sleep(retrySeconds)
  
      if api_resp is None:
          raise RuntimeError(
              f"Getting metadata['{key}'] failed for 6 tries"
          )
      return api_resp.text
  
imports: from __future__ import annotations
  import os
  import re
  import socket
  import time
  from jax._src import clusters
  from jax._src.cloud_tpu_init import running_in_cloud_tpu_vm
label_desc: Use image node_id 1 for calling a global function with example usage: get_metadata(key) and returns: api_resp