code: def test_test_patch_legacy_imports_standalone(pl_version):
      assert any(
          key.startswith("pytorch_lightning") for key in sys.modules
      ), f"Imported PL, so it has to be in sys.modules: {_list_sys_modules('pytorch_lightning')}"
      path_legacy = os.path.join(LEGACY_CHECKPOINTS_PATH, pl_version)
      path_ckpts = sorted(
          glob.glob(
              os.path.join(path_legacy, f"*{CHECKPOINT_EXTENSION}")
          )
      )
      assert (
          path_ckpts
      ), f'No checkpoints found in folder "{path_legacy}"'
      path_ckpt = path_ckpts[-1]
  
      with no_warning_call(
          match="Redirecting import of*"
      ), pl_legacy_patch():
          torch.load(path_ckpt)
  
      assert any(
          key.startswith("pytorch_lightning") for key in sys.modules
      ), f"Imported PL, so it has to be in sys.modules: {_list_sys_modules('pytorch_lightning')}"
      assert not any(
          key.startswith("lightning." + "pytorch")
          for key in sys.modules
      ), (
          "Did not import the unified package,"
          f" so it should not be in sys.modules: {_list_sys_modules('lightning' + '.pytorch')}"
      )
  
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 6 for calling a global function with example usage: test_test_patch_legacy_imports_standalone(pl_version) without return types