code: def iter_objects(
      mod: ModuleType,
      ignore_private: bool = True,
      restrict_to_type: Optional[type] = None,
      restrict_to_subclass: Optional[type] = None,
  ) -> Iterator[str]:
      for name in dir(mod):
          obj = getattr(mod, name)
          if ignore_private:
              if name.startswith("_"):
                  continue
          if restrict_to_type is not None:
              if not isinstance(obj, restrict_to_type):
                  continue
          if restrict_to_subclass is not None:
              if not (
                  isinstance(obj, type)
                  and issubclass(obj, restrict_to_subclass)
              ):
                  continue
          yield name
  
file_path: altair/tools/generate_api_docs.py
imports: import sys
  import types
  from os.path import abspath, dirname, join
  from typing import Final, Optional, Iterator, List
  from types import ModuleType
  import altair
label_desc: Use image node_id 1 for calling a global function with example usage: iter_objects(mod, ignore_private, restrict_to_type, restrict_to_subclass) without return types