code: def generate_command(
      name: str,
      options: Dict[str, Option],
      help: str,
      precheck: Optional[Callable[[], None]] = None,
      post_build: Optional[List[str]] = None,
      additional_flags: Optional[Dict[str, str]] = None,
  ):
      """
      Helper to generate CLIs that:
      1. Build a with a config matching a specific CI Docker image (e.g. 'cpu')
      2. Run tests (either a pre-defined set from scripts or manually via invoking
         pytest)
      3. (optional) Drop down into a terminal into the Docker container
      """
  
      def fn(
          tests: Optional[List[str]],
          skip_build: bool = False,
          interactive: bool = False,
          docker_image: Optional[str] = None,
          verbose: bool = False,
          **kwargs,
      ) -> None:
          """
          arguments:
          tests -- pytest test IDs (e.g. tests/python or tests/python/a_file.py::a_test[param=1])
          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
          verbose -- run verbose build
          """
          if precheck is not None:
              precheck()
  
          build_dir = get_build_dir(name)
  
          if skip_build:
              scripts = []
          else:
              scripts = [
                  f"./tests/scripts/task_config_build_{name}.sh {build_dir}",
                  f"./tests/scripts/task_build.py --build-dir {build_dir}",
              ]
  
          if post_build is not None:
              scripts += post_build
  
          # Check that a test suite was not used alongside specific test names
          if any(v for v in kwargs.values()) and tests is not None:
              option_flags = ", ".join(
                  [f"--{k}" for k in options.keys()]
              )
              clean_exit(f"{option_flags} cannot be used with --tests")
  
          if tests is not None:
              scripts.append(f"python3 -m pytest {' '.join(tests)}")
  
          # Add named test suites
          for option_name, (_, extra_scripts) in options.items():
              if kwargs.get(option_name, False):
                  scripts.extend(
                      script.format(build_dir=build_dir)
                      for script in extra_scripts
                  )
  
          docker(
              name=gen_name(f"ci-{name}"),
              image=f"ci_{name}"
              if docker_image is None
              else docker_image,
              scripts=scripts,
              env={
                  # Need to specify the library path manually or else TVM can't
                  # determine which build directory to use (i.e. if there are
                  # multiple copies of libtvm.so laying around)
                  "TVM_LIBRARY_PATH": str(
                      REPO_ROOT / get_build_dir(name)
                  ),
                  "VERBOSE": "true" if verbose else "false",
              },
              interactive=interactive,
              additional_flags=additional_flags,
          )
  
      fn.__name__ = name
  
      return fn, options, help
  
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 12 for calling a global function with example usage: generate_command(name, options, help, precheck, post_build, additional_flags) and returns: fn,  options,  help