code: def get_timestamped_export_dir(export_dir_base):
    
    attempts = 0
    while attempts < MAX_DIRECTORY_CREATION_ATTEMPTS:
      export_timestamp = int(time.time())
  
      export_dir = os.path.join(
          tf.compat.as_bytes(export_dir_base),
          tf.compat.as_bytes(str(export_timestamp)))
      if not tf_v1.gfile.Exists(export_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 export_dir
      time.sleep(1)
      attempts += 1
      logging.warn(
          "Export directory %s already exists; retrying (attempt %d/%d)",
          export_dir, attempts, MAX_DIRECTORY_CREATION_ATTEMPTS)
    raise RuntimeError("Failed to obtain a unique export directory name after "
                       "%d attempts.".MAX_DIRECTORY_CREATION_ATTEMPTS)
docs: 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.