code: def find_subclasses(
      root_python_module: types.ModuleType,
      base_class: T,
  ) -> Generator[T, None, None]:
      """Recursively traverse modules finding subclasses of the given type."""
      seen = set()
      for _, module in find_internal_python_modules(root_python_module):
          for _, value in module.__dict__.items():
              if not inspect.isclass(value) or isinstance(
                  value, types.GenericAlias
              ):
                  continue
              if issubclass(value, base_class) and value not in seen:
                  seen.add(value)
                  yield value
  
file_path: dm-haiku/haiku/_src/test_utils.py
imports: from collections.abc import Generator, Sequence
  import functools
  import inspect
  import itertools
  import os
  import types
  from typing import Any, Callable, Optional, TypeVar
  from absl.testing import parameterized
  from haiku._src import config
  from haiku._src import transform
  import jax
label_desc: Use image node_id 3 for calling a global function with example usage: find_subclasses(root_python_module, base_class) without return types