code: def print_module(mod, path, overview, depth=0, verbose=False):
      mod_name = mod.__name__.split(".")[-1]
  
      # Create a directory for the module
      mod_slug = snake_to_kebab(mod_name)
      mod_path = path.joinpath(mod_slug)
      mod_short_path = str(mod_path).replace("docs/api/", "")
      os.makedirs(mod_path, exist_ok=True)
      with open(mod_path.joinpath(".pages"), "w") as f:
          f.write(f"title: {mod_name}")
  
      # Add the module to the overview
      if depth == 0:
          print(h2(mod_name), file=overview)
      elif depth == 1:
          print(h3(mod_name), file=overview)
      elif depth == 2:
          print(h4(mod_name), file=overview)
      else:
          raise ValueError(
              "Module depth must be between 0 and 2, you went too deep!"
          )
      if mod.__doc__:
          print(md_line(mod.__doc__), file=overview)
  
      # Extract all public classes and functions
      ispublic = (
          lambda x: x.__name__ in mod.__all__
          and not x.__name__.startswith("_")
      )
      classes = inspect.getmembers(
          mod, lambda x: inspect.isclass(x) and ispublic(x)
      )
      funcs = inspect.getmembers(
          mod, lambda x: inspect.isfunction(x) and ispublic(x)
      )
  
      # Overview
      if hasattr(mod, "_docs_overview"):
          mod._docs_overview(functools.partial(print, file=overview))
      else:
          if classes and funcs:
              print("\n**Classes**\n", file=overview)
          for _, c in classes:
              slug = snake_to_kebab(c.__name__)
              print(
                  li(link(c.__name__, f"../{mod_short_path}/{slug}")),
                  end="",
                  file=overview,
              )
          if classes and funcs:
              print("\n**Functions**\n", file=overview)
          for _, f in funcs:
              slug = snake_to_kebab(f.__name__)
              print(
                  li(link(f.__name__, f"../{mod_short_path}/{slug}")),
                  end="",
                  file=overview,
              )
  
      # Docstrings
      for _, c in classes:
          if verbose:
              print(f"{mod_name}.{c.__name__}")
          slug = snake_to_kebab(c.__name__)
          with open(
              mod_path.joinpath(slug).with_suffix(".md"), "w"
          ) as file:
              print_docstring(obj=c, file=file)
  
      for _, f in funcs:
          if verbose:
              print(f"{mod_name}.{f.__name__}")
          slug = snake_to_kebab(f.__name__)
          with open(
              mod_path.joinpath(slug).with_suffix(".md"), "w"
          ) as file:
              print_docstring(obj=f, file=file)
  
      # Sub-modules
      for name, submod in inspect.getmembers(mod, inspect.ismodule):
          # We only want to go through the public submodules, such as optim.schedulers
          if (
              name in ("tags", "typing", "inspect", "skmultiflow_utils")
              or name not in mod.__all__
              or name.startswith("_")
          ):
              continue
  
          if verbose:
              print(f"{mod_name}.{name}")
  
          print_module(
              mod=submod,
              path=mod_path,
              overview=overview,
              depth=depth + 1,
              verbose=verbose,
          )
  
      print("", file=overview)
  
imports: import argparse
  import collections
  import doctest
  import functools
  import importlib
  import inspect
  import os
  import pathlib
  import re
  import shutil
  from numpydoc.docscrape import ClassDoc, FunctionDoc
label_desc: Use image node_id 14 for calling a global function with example usage: print_module(mod, path, overview, depth, verbose) without return types