code: def resource_limits_from_quotas(
      quotas: List[Dict[str, Any]]
  ) -> Optional[List[Dict[str, Any]]]:
      """create resource limits from quota dictionary
  
      Args:
      quotas: list of quota dicts, with keys {'limit', 'metric', 'usage'}
  
      Returns:
      resource limits dictionaries on success, None otherwise
      """
  
      limits = []
  
      gpu_re = re.compile("^NVIDIA_(?P<gpu>[A-Z0-9]+)_GPUS$")
  
      for q in quotas:
          metric = q["metric"]
          limit = int(q["limit"])
  
          # the api can return a limit of 0, but specifying a limit of zero
          # causes an error when configuring the cluster, so we skip any
          # resources with no quota
          if limit < 1:
              continue
  
          if metric == "CPUS":
              limits.append(
                  {"resourceType": "cpu", "maximum": str(limit)}
              )
              limits.append(
                  {
                      "resourceType": "memory",
                      "maximum": str(limit * k.MAX_GB_PER_CPU),
                  }
              )
              continue
  
          gpu_match = gpu_re.match(metric)
          if gpu_match is None:
              continue
  
          gd = gpu_match.groupdict()
          gpu_type = gd["gpu"]
  
          limits.append(
              {
                  "resourceType": "nvidia-tesla-{}".format(
                      gpu_type.lower()
                  ),
                  "maximum": str(limit),
              }
          )
  
      return limits
  
imports: from __future__ import absolute_import
  import argparse
  import json
  import logging
  import os
  import pprint
  import re
  from time import sleep
  from typing import Any, Dict, List, Optional
  from urllib.parse import urlencode, urlparse
  import google
  import yaml
  from google.auth._cloud_sdk import get_application_default_credentials_path
  from google.auth._default import _AUTHORIZED_USER_TYPE, _SERVICE_ACCOUNT_TYPE, load_credentials_from_file
  from google.cloud.container_v1 import ClusterManagerClient
  from google.cloud.container_v1.types import Cluster
  from google.oauth2 import service_account
  from googleapiclient import discovery
  from kubernetes.client import V1Job
  from kubernetes.client.api_client import ApiClient
  from yaspin import yaspin
  from yaspin.spinners import Spinners
  import caliban.platform.gke.constants
  from caliban.platform.cloud.types import GPU, TPU, GPUSpec, TPUSpec
  from caliban.platform.gke.types import CredentialsData, NodeImage, OpStatus
label_desc: Use image node_id 13 for calling a global function with example usage: resource_limits_from_quotas(quotas) and returns: limits