code: def get_latest_checkpoint(checkpoint_path):
      """Helper function to get path to latest checkpoint.
  
      Args:
        checkpoint_path: Path to the directory containing model checkpoints, or
          to a specific checkpoint (e.g. `/path/to/model.ckpt-iteration`).
  
      Returns:
        Path to latest checkpoint.
  
      Raises:
        FileNotFoundError: If no checkpoint is found.
      """
      checkpoint_path = expand_path(checkpoint_path)
      is_checkpoint = tf.io.gfile.exists(checkpoint_path + ".index")
      if is_checkpoint:
          # Return the path if it points to a checkpoint.
          return checkpoint_path
      else:
          # Search using 'checkpoints' file.
          # Returns None if no 'checkpoints' file, or directory doesn't exist.
          ckpt = tf.train.latest_checkpoint(checkpoint_path)
          if ckpt:
              return ckpt
          else:
              # Last resort, look for '/path/ckpt-[iter].index' files.
              ckpt_f = get_latest_file(
                  checkpoint_path, prefix="ckpt-", suffix=".index"
              )
              return ckpt_f.split(".index")[0]
  
file_path: ddsp/ddsp/training/train_util.py
imports: import json
  import os
  import time
  from absl import logging
  from ddsp.training import cloud
  import gin
  import tensorflow.compat.v2
label_desc: Use image node_id 4 for calling a global function with example usage: get_latest_checkpoint(checkpoint_path) and returns: checkpoint_path, ckpt, ckpt_f