code: def sanitize_job_name(name: str) -> str:
      """sanitizes job name to fit DNS-1123 restrictions:
  
      ... a DNS-1123 subdomain must consist of lower case alphanumeric characters,
      '-' or '.', and must start and end with an alphanumeric character.
  
      An zero-len string returns 'job'
      Invalid characters are replaced with '-'.
      If the job does not start with an alnum, then the prefix 'job-' is prepended.
      If the job does not end with an alnum, then the suffix '-0' is appended.
  
      Args:
      name (str): job name
  
      Returns:
      sanitized job name
      """
  
      if len(name) == 0:
          return "job"
  
      name = name.lower()
  
      # ugh, in python '²'.isalnum() returns True, so can't use isalnum
      # also, DNS-1123 is restricted, so just use re here
  
      def _valid(name):
          return k.DNS_1123_RE.match(name) is not None
  
      alnum_re = re.compile("[a-z0-9]")
      invalid_re = re.compile("[^a-z0-9\-\.]")
  
      def _alnum(x):
          return alnum_re.match(x) is not None
  
      # already valid, so done
      if _valid(name):
          return name
  
      # first char must be alnum
      if not _alnum(name[0]):
          name = "job-" + name
  
      # last char must be alnum
      if not _alnum(name[-1]):
          name = name + "-0"
  
      # replace all invalid chars with '-'
      return invalid_re.sub("-", name)
  
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 22 for calling a global function with example usage: sanitize_job_name(name) and returns: invalid_re, str, unknown, unknown, name