code: def base_image(conf: CalibanConfig, mode: JobMode) -> Optional[str]:
      """Returns a custom base image, if the user has supplied one in the
      calibanconfig.
  
      If the custom base image has a marker for a format string, like 'pytorch-{}',
      this method will fill it in with the current mode (cpu or gpu).
  
      """
      ret = None
      mode_s = mode.lower()
  
      image = conf.get("base_image")
      if image is None:
          return ret
  
      elif isinstance(image, str):
          ret = image
  
      else:
          # dictionary case.
          ret = image[mode_s]
  
      # we run expand_image again in case the user has included a format {} in the
      # string.
      return expand_image(ret.format(mode_s))
  
imports: import os
  import sys
  from enum import Enum
  from typing import Any, Dict, List, Optional, Tuple
  import schema
  import caliban.platform.cloud.types
  import caliban.util.schema
label_desc: Use image node_id 9 for calling a global function with example usage: base_image(conf, mode) and returns: expand_image, ret