code: def _capture(args: List[str]):
      base_url = get_app_url_for_handle("track")
      if base_url is None:
          raise RuntimeError(
              f"Please specify `labml_app_url` environment variable. "
              f"How to setup a labml server https://github.com/labmlai/labml/tree/master/app"
          )
  
      app_tracker = AppTracker(
          base_url, {"run_uuid": generate_uuid()}, timeout_seconds=120
      )
      app_console_logs = AppConsoleLogs()
      data = {
          "name": "Capture",
          "comment": " ".join(args),
          "time": time.time(),
      }
  
      app_tracker.add_handler(
          AppUrlResponseHandler(True, "Monitor output at ")
      )
      app_tracker.has_data(SimpleAppTrackDataSource(data))
      app_console_logs.set_app_tracker(app_tracker, frequency=0)
  
      logger.log("Start capturing...", Text.meta)
      if args:
          thread = ExecutorThread(" ".join(args), app_console_logs)
          thread.start()
          thread.join()
      else:
          buffer = ""
          stdin = sys.stdin
          while stdin.readable():
              data = stdin.read(1)
              if len(data) == 0:
                  break
              print(data, end="")
              buffer += data
              if "\n" in buffer or len(buffer) > 100:
                  app_console_logs.outputs(stdout_=buffer)
                  buffer = ""
          if len(buffer) > 0:
              app_console_logs.outputs(stdout_=buffer)
  
      data = {
          "rank": 0,
          "status": "completed",
          "details": None,
          "time": time.time(),
      }
  
      app_tracker.has_data(
          SimpleAppTrackDataSource(
              {"status": data, "time": time.time()}
          )
      )
  
      app_tracker.stop()
  
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 2 for calling a global function with example usage: _capture(args) without return types