code: def main():
      parser = argparse.ArgumentParser(
          description="labml.ai CLI",
          formatter_class=argparse.ArgumentDefaultsHelpFormatter,
      )
      subparser = parser.add_subparsers(
          title="command", dest="command", required=True
      )
      app_server_parser = subparser.add_parser(
          COMMAND_APP_SERVER,
          help="Start a local instance of labml server",
          formatter_class=parser.formatter_class,
      )
      app_server_parser.add_argument(
          "--ip",
          type=ip_validator,
          default="0.0.0.0",
          help="IP to bind the server",
      )
      app_server_parser.add_argument(
          "--port",
          type=int,
          default=5005,
          help="Port to run the server on",
      )
  
      capture_parser = subparser.add_parser(
          COMMAND_CAPTURE, help="Create an experiment manually"
      )
      capture_parser.add_argument("args", nargs=argparse.REMAINDER)
  
      launch_parser = subparser.add_parser(
          COMMAND_LAUNCH, help="Start a distributed training session"
      )
      launch_parser.add_argument("args", nargs=argparse.REMAINDER)
  
      subparser.add_parser(
          COMMAND_MONITOR, help="Start hardware monitoring"
      )
      subparser.add_parser(
          COMMAND_SERVICE,
          help="Setup and start a service for hardware monitoring",
      )
      subparser.add_parser(
          COMMAND_SERVICE_RUN,
          help="Start hardware monitoring (for internal use)",
      )
  
      args = parser.parse_args()
  
      if args.command == COMMAND_APP_SERVER:
          _start_app_server(ip=args.ip, port=args.port)
      elif args.command == COMMAND_CAPTURE:
          _capture(args.args)
      elif args.command == COMMAND_LAUNCH:
          _launch(args.args)
      elif args.command == COMMAND_MONITOR:
          _monitor()
      elif args.command == COMMAND_SERVICE:
          _service()
      elif args.command == COMMAND_SERVICE_RUN:
          _service_run()
      else:
          raise ValueError("Unknown command", args.command)
  
imports: import argparse
  import os
  import subprocess
  import sys
  import threading
  import time
  from typing import List
  from labml import logger, experiment
  from labml.experiment import generate_uuid
  from labml.internal.app import AppTracker, SimpleAppTrackDataSource
  from labml.internal.app.logs import AppConsoleLogs
  from labml.internal.app.url import AppUrlResponseHandler
  from labml.internal.lab import get_app_url_for_handle
  from labml.logger import Text
  from labml.utils.validators import ip_validator
label_desc: Use image node_id 7 for calling a global function with example usage: main() without return types