code: def check_version(args):
      try:
          trial_keeper_version = pkg_resources.get_distribution(
              "nni"
          ).version
      except pkg_resources.ResolutionError:
          # package nni does not exist, try nni-tool package
          nni_log(LogType.Error, "Package nni does not exist!")
          os._exit(1)
      if not args.nni_manager_version:
          # skip version check
          nni_log(LogType.Warning, "Skipping version check!")
      else:
          try:
              trial_keeper_version = regular.search(
                  trial_keeper_version
              ).group("version")
              nni_log(
                  LogType.Info,
                  "trial_keeper_version is {0}".format(
                      trial_keeper_version
                  ),
              )
              nni_manager_version = regular.search(
                  args.nni_manager_version
              ).group("version")
              nni_log(
                  LogType.Info,
                  "nni_manager_version is {0}".format(
                      nni_manager_version
                  ),
              )
              log_entry = {}
              if trial_keeper_version != nni_manager_version:
                  nni_log(LogType.Warning, "Version does not match!")
                  error_message = "NNIManager version is {0}, TrialKeeper version is {1}, NNI version does not match!".format(
                      nni_manager_version, trial_keeper_version
                  )
                  log_entry["tag"] = "VCFail"
                  log_entry["msg"] = error_message
                  rest_post(
                      gen_send_version_url(
                          args.nnimanager_ip, args.nnimanager_port
                      ),
                      json.dumps(log_entry),
                      10,
                      False,
                  )
              else:
                  nni_log(LogType.Info, "Version match!")
                  log_entry["tag"] = "VCSuccess"
                  rest_post(
                      gen_send_version_url(
                          args.nnimanager_ip, args.nnimanager_port
                      ),
                      json.dumps(log_entry),
                      10,
                      False,
                  )
          except AttributeError as err:
              nni_log(LogType.Error, err)
  
imports: import argparse
  import ctypes
  import json
  import logging
  import os
  import re
  import shlex
  import sys
  import threading
  import time
  from subprocess import Popen
  import pkg_resources
  from pyhdfs import HdfsClient
  from .constants import LOG_DIR, MULTI_PHASE, NNI_EXP_ID, NNI_PLATFORM, NNI_SYS_DIR, NNI_TRIAL_JOB_ID
  from .hdfsClientUtility import copyDirectoryToHdfs, copyHdfsDirectoryToLocal, copyHdfsFileToLocal
  from .log_utils import LogType, RemoteLogger, StdOutputType, nni_log
  from .rest_utils import rest_get, rest_post
  from .url_utils import gen_parameter_meta_url, gen_send_version_url
label_desc: Use image node_id 4 for calling a global function with example usage: check_version(args) without return types