code: def _pl_migrate_checkpoint(
      checkpoint: _CHECKPOINT, checkpoint_path: Optional[_PATH] = None
  ) -> _CHECKPOINT:
      """Applies Lightning version migrations to a checkpoint dictionary and prints infos for the user.
  
      This function is used by the Lightning Trainer when resuming from a checkpoint.
  
      """
      old_version = _get_version(checkpoint)
      checkpoint, migrations = migrate_checkpoint(checkpoint)
      new_version = _get_version(checkpoint)
      if not migrations or checkpoint_path is None:
          # the checkpoint was already a new one, no migrations were needed
          return checkpoint
  
      # include the full upgrade command, including the path to the loaded file in the error message,
      # so user can copy-paste and run if they want
      # side-step bug: ValueError: path is on mount 'C:', start on mount 'D:'
      path_hint = (
          os.path.relpath(checkpoint_path, os.getcwd())
          if not _IS_WINDOWS
          else os.path.abspath(checkpoint_path)
      )
      _log.info(
          f"Lightning automatically upgraded your loaded checkpoint from v{old_version} to v{new_version}."
          " To apply the upgrade to your files permanently, run"
          f" `python -m lightning.pytorch.utilities.upgrade_checkpoint {str(path_hint)}`"
      )
      return checkpoint
  
imports: import logging
  import os
  import pickle
  import sys
  import threading
  import warnings
  from types import ModuleType, TracebackType
  from typing import Any, Dict, List, Optional, Tuple, Type
  from packaging.version import Version
  import lightning.pytorch
  from lightning.fabric.utilities.enums import LightningEnum
  from lightning.fabric.utilities.imports import _IS_WINDOWS
  from lightning.fabric.utilities.types import _PATH
  from lightning.fabric.utilities.warnings import PossibleUserWarning
  from lightning.pytorch.utilities.migration.migration import _migration_index
  from lightning.pytorch.utilities.rank_zero import rank_zero_warn
label_desc: Use image node_id 2 for calling a global function with example usage: _pl_migrate_checkpoint(checkpoint, checkpoint_path) and returns: checkpoint, checkpoint