code: def test_migrate_checkpoint_for_pl(caplog):
      """Test that the automatic migration in Lightning informs the user about how to make the upgrade permanent."""
      # simulate a very recent checkpoint, no migrations needed
      loaded_checkpoint = {
          "pytorch-lightning_version": pl.__version__,
          "global_step": 2,
          "epoch": 0,
      }
      new_checkpoint = _pl_migrate_checkpoint(
          loaded_checkpoint, "path/to/ckpt"
      )
      assert new_checkpoint == {
          "pytorch-lightning_version": pl.__version__,
          "global_step": 2,
          "epoch": 0,
      }
  
      # simulate an old checkpoint that needed an upgrade
      loaded_checkpoint = {
          "pytorch-lightning_version": "0.0.1",
          "global_step": 2,
          "epoch": 0,
      }
      with caplog.at_level(
          logging.INFO,
          logger="lightning.pytorch.utilities.migration.utils",
      ):
          new_checkpoint = _pl_migrate_checkpoint(
              loaded_checkpoint, "path/to/ckpt"
          )
      assert new_checkpoint == {
          "legacy_pytorch-lightning_version": "0.0.1",
          "pytorch-lightning_version": pl.__version__,
          "callbacks": {},
          "global_step": 2,
          "epoch": 0,
          "loops": ANY,
      }
      assert (
          f"Lightning automatically upgraded your loaded checkpoint from v0.0.1 to v{pl.__version__}"
          in caplog.text
      )
  
imports: import glob
  import logging
  import os
  import pickle
  import sys
  from unittest.mock import ANY
  import lightning.pytorch
  import pytest
  import torch
  from lightning.fabric.utilities.warnings import PossibleUserWarning
  from lightning.pytorch.utilities.migration import migrate_checkpoint, pl_legacy_patch
  from lightning.pytorch.utilities.migration.utils import _pl_migrate_checkpoint, _RedirectingUnpickler
  from lightning_utilities.core.imports import module_available
  from lightning_utilities.test.warning import no_warning_call
  from packaging.version import Version
  from tests_pytorch.checkpointing.test_legacy_checkpoints import CHECKPOINT_EXTENSION, LEGACY_BACK_COMPATIBLE_PL_VERSIONS, LEGACY_CHECKPOINTS_PATH
label_desc: Use image node_id 11 for calling a global function with example usage: test_migrate_checkpoint_for_pl(caplog) without return types