code: def generate_min_dependency_table(app):
      """Generate min dependency table for docs."""
      from sklearn._min_dependencies import dependent_packages
  
      # get length of header
      package_header_len = (
          max(len(package) for package in dependent_packages) + 4
      )
      version_header_len = len("Minimum Version") + 4
      tags_header_len = (
          max(len(tags) for _, tags in dependent_packages.values()) + 4
      )
  
      output = StringIO()
      output.write(
          " ".join(
              [
                  "=" * package_header_len,
                  "=" * version_header_len,
                  "=" * tags_header_len,
              ]
          )
      )
      output.write("\n")
      dependency_title = "Dependency"
      version_title = "Minimum Version"
      tags_title = "Purpose"
  
      output.write(
          f"{dependency_title:<{package_header_len}} "
          f"{version_title:<{version_header_len}} "
          f"{tags_title}\n"
      )
  
      output.write(
          " ".join(
              [
                  "=" * package_header_len,
                  "=" * version_header_len,
                  "=" * tags_header_len,
              ]
          )
      )
      output.write("\n")
  
      for package, (version, tags) in dependent_packages.items():
          output.write(
              f"{package:<{package_header_len}} {version:<{version_header_len}} {tags}\n"
          )
  
      output.write(
          " ".join(
              [
                  "=" * package_header_len,
                  "=" * version_header_len,
                  "=" * tags_header_len,
              ]
          )
      )
      output.write("\n")
      output = output.getvalue()
  
      with (Path(".") / "min_dependency_table.rst").open("w") as f:
          f.write(output)
  
imports: import os
  import re
  import sys
  import warnings
  from datetime import datetime
  from io import StringIO
  from pathlib import Path
  from sklearn.externals._packaging.version import parse
  import sphinx_gallery
  from github_link import make_linkcode_resolve
  from sphinx_gallery.notebook import add_code_cell, add_markdown_cell
  from sphinx_gallery.sorting import ExampleTitleSortKey
  import sklearn
  from sklearn.experimental import enable_iterative_imputer
  from sklearn.experimental import enable_halving_search_cv
  from sklearn.utils.fixes import VisibleDeprecationWarning
label_desc: Use image node_id 5 for calling a global function with example usage: generate_min_dependency_table(app) without return types