code: def copy_nni_node(version):
      """
      Copy compiled JS files to nni_node.
      This is meant for building release package, so you need to provide version string.
      The version will written to `package.json` in nni_node directory,
      while `package.json` in ts directory will be left unchanged.
      """
      _print("Copying files")
  
      if sys.version_info >= (3, 8):
          shutil.copytree(
              "ts/nni_manager/dist", "nni_node", dirs_exist_ok=True
          )
      else:
          for item in os.listdir("ts/nni_manager/dist"):
              subsrc = os.path.join("ts/nni_manager/dist", item)
              subdst = os.path.join("nni_node", item)
              if os.path.isdir(subsrc):
                  shutil.copytree(subsrc, subdst)
              else:
                  shutil.copy2(subsrc, subdst)
      shutil.copyfile(
          "ts/nni_manager/package-lock.json",
          "nni_node/package-lock.lock",
      )
      Path("nni_node/nni_manager.tsbuildinfo").unlink()
  
      package_json = json.load(open("ts/nni_manager/package.json"))
      if version:
          while (
              len(version.split(".")) < 3
          ):  # node.js semver requires at least three parts
              version = version + ".0"
          package_json["version"] = version
      json.dump(
          package_json, open("nni_node/package.json", "w"), indent=2
      )
  
      if sys.platform == "win32":
          # On Windows, manually install node-gyp for sqlite3.
          _npm("ts/nni_manager", "install", "--global", "node-gyp")
  
      # reinstall without development dependencies
      prod_path = Path("nni_node").resolve()
      _npm(str(prod_path), "install", "--omit", "dev")
  
      shutil.copytree("ts/webui/build", "nni_node/static")
  
imports: from io import BytesIO
  import json
  import os
  from pathlib import Path
  import platform
  import shutil
  import subprocess
  import sys
  import tarfile
  import traceback
  from zipfile import ZipFile
label_desc: Use image node_id 10 for calling a global function with example usage: copy_nni_node(version) without return types