code: def get_subclasses(
      klass,
      stop_classes=(Module, Component, torch.nn.modules.module.Module),
  ):
      ret = set()
  
      def add_subclasses(k):
          for b in k.__bases__:
              if b not in stop_classes:
                  ret.add(b)
                  add_subclasses(b)
  
      add_subclasses(klass)
      return ret
  
file_path: pytext/pytext/utils/documentation.py
imports: from enum import Enum
  from inspect import getmembers, isclass, isfunction
  from sys import modules
  from typing import Union
  import torch
  from pytext.config.component import Component, get_component_name
  from pytext.config.pytext_config import ConfigBase
  from pytext.models.module import Module
label_desc: Use image node_id 4 for calling a global function with example usage: get_subclasses(klass, stop_classes) and returns: ret