code: def _make_checkpoint_manager(
      checkpoint, checkpoint_dir, cluster_resolver
  ):
      if (
          not cluster_resolver
          or not cluster_resolver.cluster_spec().as_dict()
          or (
              multi_worker_util.is_chief(
                  cluster_spec=cluster_resolver.cluster_spec(),
                  task_type=cluster_resolver.task_type,
                  task_id=cluster_resolver.task_id,
              )
          )
      ):
          return checkpoint_management.CheckpointManager(
              checkpoint, directory=checkpoint_dir, max_to_keep=1
          )
      else:
          return checkpoint_management.CheckpointManager(
              checkpoint,
              directory=failure_handling._non_chief_checkpoint_dir(
                  checkpoint_dir, cluster_resolver.task_id
              ),
              max_to_keep=1,
          )
  
imports: import os
  import random
  import re
  import sys
  import threading
  import time
  import urllib
  from absl.testing import parameterized
  from tensorflow.python.checkpoint import checkpoint
  from tensorflow.python.checkpoint import checkpoint_management
  from tensorflow.python.distribute import collective_all_reduce_strategy
  from tensorflow.python.distribute import combinations
  from tensorflow.python.distribute import mirrored_strategy
  from tensorflow.python.distribute import multi_process_runner
  from tensorflow.python.distribute import multi_worker_test_base
  from tensorflow.python.distribute import multi_worker_util
  from tensorflow.python.distribute import one_device_strategy
  from tensorflow.python.distribute import test_util
  from tensorflow.python.distribute.failure_handling import failure_handling
  from tensorflow.python.distribute.failure_handling import failure_handling_util
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import config
  from tensorflow.python.framework import constant_op
  from tensorflow.python.module import module
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import gfile
  from tensorflow.python.platform import test
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.training import server_lib
label_desc: Use image node_id 2 for calling a global function with example usage: _make_checkpoint_manager(checkpoint, checkpoint_dir, cluster_resolver) and returns: checkpoint_management, checkpoint_management