code: def find_all_classes(
      module_path: Union[str, ModuleType], cls: type
  ) -> List[type]:
      """
      Find all the classes recursively that inherit from `cls` in a given module.
      - `cls` itself is also included
  
          >>> from qlib.data.dataset.handler import DataHandler
          >>> find_all_classes("qlib.contrib.data.handler", DataHandler)
          [<class 'qlib.contrib.data.handler.Alpha158'>, <class 'qlib.contrib.data.handler.Alpha158vwap'>, <class 'qlib.contrib.data.handler.Alpha360'>, <class 'qlib.contrib.data.handler.Alpha360vwap'>, <class 'qlib.data.dataset.handler.DataHandlerLP'>]
  
      TODO:
      - skip import error
  
      """
      if isinstance(module_path, ModuleType):
          mod = module_path
      else:
          mod = importlib.import_module(module_path)
  
      cls_list = []
  
      def _append_cls(obj):
          # Leverage the closure trick to reuse code
          if (
              isinstance(obj, type)
              and issubclass(obj, cls)
              and cls not in cls_list
          ):
              cls_list.append(obj)
  
      for attr in dir(mod):
          _append_cls(getattr(mod, attr))
  
      if hasattr(mod, "__path__"):
          # if the model is a package
          for _, modname, _ in pkgutil.iter_modules(mod.__path__):
              sub_mod = importlib.import_module(
                  f"{mod.__package__}.{modname}"
              )
              for m_cls in find_all_classes(sub_mod, cls):
                  _append_cls(m_cls)
      return cls_list
  
file_path: qlib/qlib/utils/mod.py
imports: import contextlib
  import importlib
  import os
  from pathlib import Path
  import pickle
  import pkgutil
  import re
  import sys
  from types import ModuleType
  from typing import Any, Dict, List, Tuple, Union
  from urllib.parse import urlparse
  from qlib.typehint import InstConf
label_desc: Use image node_id 6 for calling a global function with example usage: find_all_classes(module_path, cls) and returns: cls_list