code: def test_import_depth(
      ignore=[
          "lightning.app.cli",
          "lightning.app.components.serve.types",
          "lightning.app.core",
          "lightning.app.launcher",
          "lightning.app.runners",
          "lightning.app.utilities",
      ]
  ):
      """This test ensures that any public exports (functions, classes, etc.) can be imported by users with at most a
      depth of two. This guarantees that everything user-facing can be imported with (at most) ``lightning.app.*.*``.
  
      Args:
          ignore: Sub-module paths to ignore (usually sub-modules that are not intended to be user-facing).
  
      """
      exports = _find_exports(lightning.app)
      depths = {
          export: len(path.replace("lightning.app", "").split("."))
          for export, path in exports.items()
      }
      deep_exports = [
          export for export, depth in depths.items() if depth > 2
      ]
      deep_exports = list(
          filter(
              lambda export: not any(
                  exports[export].startswith(path) for path in ignore
              ),
              deep_exports,
          )
      )
      if len(deep_exports) > 0:
          raise RuntimeError(
              "Found exports with a depth greater than two. "
              "Either expose them at a higher level or make them private. "
              f"Found: {', '.join(sorted(f'{exports[export]}.{export}' for export in deep_exports))}"
          )
  
file_path: pytorch-lightning/tests/tests_app/test_imports.py
imports: import importlib
  import inspect
  import os
  import types
  from typing import TypeVar
  import lightning.app
label_desc: Use image node_id 3 for calling a global function with example usage: test_import_depth(ignore) without return types