code: def get_all_checkpoints(dir: str, prefix: str = "model"):
      """
      Get a sorted list of all checkpoints found in directory.
  
      Args:
          dir (str): checkpoint directory
          prefix (str): common prefix among all checkpoints (without the final "-")
  
      Returns:
          list[(str, int)]: list of (name, step) sorted by step.
          Name is a checkpoint handle that can be passed to
          `tf.train.NewCheckpointReader` or :func:`load_checkpoint_vars`.
      """
  
      def step_from_filename(name):
          name = os.path.basename(name)
          name = name[len("{}-".format(prefix)) : -len(".index")]
          return int(name)
  
      checkpoints = glob.glob(os.path.join(dir, "model-*.index"))
      checkpoints = [(f, step_from_filename(f)) for f in checkpoints]
      checkpoints = sorted(checkpoints, key=operator.itemgetter(1))
      return checkpoints
  
imports: import glob
  import operator
  import numpy
  import os
  import pprint
  import six
  import tensorflow
  from ..compat import tfv1
  from ..utils import logger
  from .common import get_op_tensor_name
label_desc: Use image node_id 5 for calling a global function with example usage: get_all_checkpoints(dir, prefix) and returns: checkpoints, int