code: def get_timestamped_export_dir(export_dir_base):
      """Builds a path to a new subdirectory within the base directory.
  
      Each export is written into a new subdirectory named using the
      current time.  This guarantees monotonically increasing version
      numbers even across multiple runs of the pipeline.
      The timestamp used is the number of seconds since epoch UTC.
  
      Args:
        export_dir_base: A string containing a directory to write the exported
            graph and checkpoints.
      Returns:
        The full path of the new subdirectory (which is not actually created yet).
  
      Raises:
        RuntimeError: if repeated attempts fail to obtain a unique timestamped
          directory name.
      """
      attempts = 0
      while attempts < MAX_DIRECTORY_CREATION_ATTEMPTS:
          timestamp = int(time.time())
  
          result_dir = file_io.join(
              compat.as_bytes(export_dir_base),
              compat.as_bytes(str(timestamp)),
          )
          if not gfile.Exists(result_dir):
              # Collisions are still possible (though extremely unlikely): this
              # directory is not actually created yet, but it will be almost
              # instantly on return from this function.
              return result_dir
          time.sleep(1)
          attempts += 1
          logging.warn(
              "Directory {} already exists; retrying (attempt {}/{})".format(
                  compat.as_str(result_dir),
                  attempts,
                  MAX_DIRECTORY_CREATION_ATTEMPTS,
              )
          )
      raise RuntimeError(
          "Failed to obtain a unique export directory name after "
          f"{MAX_DIRECTORY_CREATION_ATTEMPTS} attempts."
      )
  
imports: import collections
  import os
  import time
  from tensorflow.python.lib.io import file_io
  from tensorflow.python.ops import op_selector
  from tensorflow.python.platform import gfile
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.saved_model import signature_constants
  from tensorflow.python.saved_model import signature_def_utils
  from tensorflow.python.saved_model import tag_constants
  from tensorflow.python.saved_model import utils
  from tensorflow.python.saved_model.model_utils import export_output
  from tensorflow.python.saved_model.model_utils import mode_keys
  from tensorflow.python.saved_model.model_utils.mode_keys import KerasModeKeys
  from tensorflow.python.util import compat
  from tensorflow.python.util import nest
  from tensorflow.python.util import object_identity
label_desc: Use image node_id 5 for calling a global function with example usage: get_timestamped_export_dir(export_dir_base) and returns: result_dir