code: def docs(
      tutorial_pattern: Optional[str] = None,
      cpu: bool = False,
      full: bool = False,
      interactive: bool = False,
      skip_build: bool = False,
      docker_image: Optional[str] = None,
  ) -> None:
      """
      Build the documentation from gallery/ and docs/. By default this builds only
      the Python docs without any tutorials.
  
      arguments:
      full -- Build all language docs, not just Python (cannot be used with --cpu)
      cpu -- Use the 'ci_cpu' Docker image (useful for building docs on a machine without a GPU)
      tutorial-pattern -- Regex for which tutorials to execute when building docs (cannot be used with --cpu)
      skip_build -- skip build and setup scripts
      interactive -- start a shell after running build / test scripts
      docker-image -- manually specify the docker image to use
      """
      build_dir = get_build_dir("gpu")
  
      extra_setup = []
      image = "ci_gpu" if docker_image is None else docker_image
      if cpu:
          # TODO: Change this to tlcpack/docs once that is uploaded
          image = "ci_cpu" if docker_image is None else docker_image
          build_dir = get_build_dir("cpu")
          config_script = " && ".join(
              [
                  f"mkdir -p {build_dir}",
                  f"pushd {build_dir}",
                  "cp ../cmake/config.cmake .",
                  # The docs import tvm.micro, so it has to be enabled in the build
                  "echo set\(USE_MICRO ON\) >> config.cmake",
                  "popd",
              ]
          )
  
          # These are taken from the ci-gpu image via pip freeze, consult that
          # if there are any changes: https://github.com/apache/tvm/tree/main/docs#native
          requirements = [
              "Sphinx==4.2.0",
              "tlcpack-sphinx-addon==0.2.1",
              "image==1.5.33",
              # Temporary git link until a release is published
              "git+https://github.com/sphinx-gallery/sphinx-gallery.git@6142f1791151849b5bec4bf3959f75697ba226cd",
              "sphinx-rtd-theme==1.0.0",
              "matplotlib==3.3.4",
              "commonmark==0.9.1",
              "Pillow==8.3.2",
              "autodocsumm==0.2.7",
              "docutils==0.16",
          ]
  
          extra_setup = [
              "python3 -m pip install " + " ".join(requirements),
          ]
      else:
          check_gpu()
          config_script = (
              f"./tests/scripts/task_config_build_gpu.sh {build_dir}"
          )
  
      scripts = extra_setup + [
          config_script,
          f"./tests/scripts/task_build.py --build-dir {build_dir}",
      ]
  
      if skip_build:
          scripts = []
  
      scripts.append("./tests/scripts/task_python_docs.sh")
  
      if tutorial_pattern is None:
          tutorial_pattern = os.getenv(
              "TVM_TUTORIAL_EXEC_PATTERN", ".py" if full else "none"
          )
  
      env = {
          "TVM_TUTORIAL_EXEC_PATTERN": tutorial_pattern,
          "PYTHON_DOCS_ONLY": "0" if full else "1",
          "IS_LOCAL": "1",
          "TVM_LIBRARY_PATH": str(REPO_ROOT / build_dir),
      }
      docker(
          name=gen_name("docs"),
          image=image,
          scripts=scripts,
          env=env,
          interactive=interactive,
      )
      print_color(
          col.GREEN,
          "Done building the docs. You can view them by running "
          "'python3 tests/scripts/ci.py serve-docs' and visiting:"
          " http://localhost:8000 in your browser.",
          bold=True,
      )
  
imports: import sys
  import multiprocessing
  import os
  import getpass
  import inspect
  import argparse
  import json
  import shutil
  import grp
  import string
  import random
  import subprocess
  import platform
  import textwrap
  import typing
  from pathlib import Path
  from typing import List, Dict, Any, Optional, Tuple, Callable, Union
label_desc: Use image node_id 9 for calling a global function with example usage: docs(tutorial_pattern, cpu, full, interactive, skip_build, docker_image) without return types