code: def loaded_modules(import_module, depth=None, all_modules=False):
      """Import the given module in subprocess and return set of loaded modules
  
      Import a certain module in a clean subprocess and return the
      modules that are subsequently loaded. The given depth indicates the
      module level (i.e. depth=1 will only yield 'X.Y' but not 'X.Y.Z').
      """
  
      imageio_dir = os.path.dirname(
          os.path.dirname(os.path.abspath(imageio.__file__))
      )
  
      # Get the loaded modules in a clean interpreter
      code = (
          "import sys, %s; print(', '.join(sys.modules))"
          % import_module
      )
      res = run_subprocess(
          [sys.executable, "-c", code], cwd=imageio_dir
      )[0]
      loaded_modules = [name.strip() for name in res.split(",")]
  
      # Filter by depth
      filtered_modules = set()
      if depth is None:
          filtered_modules = set(loaded_modules)
      else:
          for m in loaded_modules:
              parts = m.split(".")
              m = ".".join(parts[:depth])
              filtered_modules.add(m)
  
      # Filter by imageio (or not)
      if all_modules:
          return filtered_modules
      else:
          imageio_modules = set()
          for m in filtered_modules:
              if m.startswith("imageio") and "__future__" not in m:
                  imageio_modules.add(m)
          return imageio_modules
  
file_path: imageio/tests/test_meta.py
imports: from __future__ import print_function
  import os
  import sys
  import subprocess
  from pytest import raises
  import imageio
label_desc: Use image node_id 2 for calling a global function with example usage: loaded_modules(import_module, depth, all_modules) and returns: filtered_modules, imageio_modules