code: def test_import_deepspeed_lazily():
      """Test that we are importing deepspeed only when necessary."""
      code = dedent(
          """
          import lightning.pytorch
          import sys
  
          assert 'deepspeed' not in sys.modules
          from lightning.pytorch.strategies import DeepSpeedStrategy
          from lightning.pytorch.plugins import DeepSpeedPrecision
          assert 'deepspeed' not in sys.modules
  
          import deepspeed
          assert 'deepspeed' in sys.modules
          """
      )
      # run in complete isolation
      assert subprocess.call([sys.executable, "-c", code]) == 0
  
file_path: pytorch-lightning/tests/tests_pytorch/utilities/test_imports.py
imports: import importlib
  import subprocess
  import sys
  from textwrap import dedent
  from unittest import mock
  import pytest
  from lightning.pytorch.utilities.imports import _OMEGACONF_AVAILABLE
  from lightning_utilities.core.imports import RequirementCache
  from torch.distributed import is_available
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 6 for calling a global function with example usage: test_import_deepspeed_lazily() without return types