code: def _synchronize_and_checkpoint(
      core_context: core.Context,
      steps_completed: int,
      default_output_uuid: str,
  ) -> None:
      """
      Synchronize the workers and create checkpoint to record steps completed
      """
      if core_context.distributed.get_rank() == 0:
          steps_completed_list = core_context.distributed.gather(
              steps_completed
          )
          if steps_completed_list is None:
              return
          min_steps_completed = min(steps_completed_list)
  
          checkpoint_metadata = {
              "steps_completed": min_steps_completed,
              "default_output_uuid": default_output_uuid,
          }
          with core_context.checkpoint.store_path(
              checkpoint_metadata
          ) as (path, uuid):
              with open(
                  os.path.join(path, "batch_completed.json"), "w"
              ) as file_obj:
                  json.dump(
                      {"batch_completed": min_steps_completed}, file_obj
                  )
      else:
          core_context.distributed.gather(steps_completed)
  
imports: import abc
  import json
  import logging
  import math
  import os
  import pathlib
  import uuid
  import warnings
  from typing import TYPE_CHECKING, Any, ContextManager, Dict, Optional, Set, Sized, Type
  import torch
  import torch.distributed
  from torch import nn
  from torch.utils import data
  import determined
  from determined import common, core, pytorch
label_desc: Use image node_id 5 for calling a global function with example usage: _synchronize_and_checkpoint(core_context, steps_completed, default_output_uuid) without return types