code: def test_legacy_ckpt_threading(tmpdir, pl_version: str):
      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]
  
      def load_model():
          import torch
          from lightning.pytorch.utilities.migration import (
              pl_legacy_patch,
          )
  
          with pl_legacy_patch():
              _ = torch.load(path_ckpt)
  
      with patch("sys.path", [PATH_LEGACY] + sys.path):
          t1 = ThreadExceptionHandler(target=load_model)
          t2 = ThreadExceptionHandler(target=load_model)
  
          t1.start()
          t2.start()
  
          t1.join()
          t2.join()
  
imports: import glob
  import os
  import sys
  from unittest.mock import patch
  import lightning.pytorch
  import pytest
  import torch
  from lightning.pytorch import Callback, Trainer
  from tests_pytorch import _PATH_LEGACY
  from tests_pytorch.helpers.datamodules import ClassifDataModule
  from tests_pytorch.helpers.runif import RunIf
  from tests_pytorch.helpers.simple_models import ClassificationModel
  from tests_pytorch.helpers.threading import ThreadExceptionHandler
label_desc: Use image node_id 2 for calling a global function with example usage: test_legacy_ckpt_threading(tmpdir, pl_version) without return types