code: def wait_pod(
      core_api: k8s_client.CoreV1Api,
      pod_name: str,
      namespace: str,
      exit_condition_lambda: Callable[[k8s_client.V1Pod], bool],
      condition_description: str,
      timeout_sec: int = 0,
      exponential_backoff: bool = False,
  ) -> k8s_client.V1Pod:
      """Wait for a Pod to meet an exit condition.
  
      Args:
        core_api: Client of Core V1 API of Kubernetes API.
        pod_name: The name of the Pod.
        namespace: The namespace of the Pod.
        exit_condition_lambda: A lambda which will be called intervally to wait for
          a Pod to exit. The function returns True to exit.
        condition_description: The description of the exit condition which will be
          set in the error message if the wait times out.
        timeout_sec: Timeout in seconds to wait for pod to reach exit condition, or
          0 to wait for an unlimited duration. Defaults to unlimited.
        exponential_backoff: Whether to use exponential back off for polling.
          Defaults to False.
  
      Returns:
        The Pod object which meets the exit condition.
      Raises:
        RuntimeError: when the function times out.
      """
      start_time = datetime.datetime.utcnow()
      # Link to exponential back-off algorithm used here:
      # https://cloud.google.com/storage/docs/exponential-backoff
      backoff_interval = 1
      maximum_backoff = 32
      while True:
          resp = get_pod(core_api, pod_name, namespace)
          logging.info(resp.status.phase)
          if exit_condition_lambda(resp):
              return resp
          elapse_time = datetime.datetime.utcnow() - start_time
          if elapse_time.seconds >= timeout_sec and timeout_sec != 0:
              raise RuntimeError(
                  'Pod "%s:%s" does not reach "%s" within %s seconds.'
                  % (
                      namespace,
                      pod_name,
                      condition_description,
                      timeout_sec,
                  )
              )
          time.sleep(backoff_interval)
          if exponential_backoff and backoff_interval < maximum_backoff:
              backoff_interval *= 2
  
imports: import datetime
  import enum
  import os
  import re
  import time
  from typing import Callable, Dict, List, Optional
  from absl import logging
  from kubernetes import client
  from kubernetes import config
label_desc: Use image node_id 12 for calling a global function with example usage: wait_pod(core_api, pod_name, namespace, exit_condition_lambda, condition_description, timeout_sec, exponential_backoff) and returns: resp