code: def _migrate_loop_batches_that_stepped(
      checkpoint: _CHECKPOINT,
  ) -> _CHECKPOINT:
      """Sets the `_batches_that_stepped` default value for checkpoints before v1.6.5 which don't have this key.
  
      Version: 1.6.5
      Commit: c67b075
      PR: #13645
  
      """
      global_step = checkpoint["global_step"]
      checkpoint["loops"]["fit_loop"][
          "epoch_loop.state_dict"
      ].setdefault("_batches_that_stepped", global_step)
      return checkpoint
  
file_path: pytorch-lightning/src/lightning/pytorch/utilities/migration/migration.py
imports: import re
  from typing import Any, Callable, Dict, List
  from lightning.fabric.utilities.warnings import PossibleUserWarning
  from lightning.pytorch.callbacks.early_stopping import EarlyStopping
  from lightning.pytorch.callbacks.model_checkpoint import ModelCheckpoint
  from lightning.pytorch.utilities.rank_zero import rank_zero_warn
label_desc: Use image node_id 5 for calling a global function with example usage: _migrate_loop_batches_that_stepped(checkpoint) and returns: checkpoint