code: def build_kernelspec(
      name: str, provisioner: Optional[str] = None
  ) -> None:
      spec: dict = {
          "argv": [
              sys.executable,
              "-m",
              "tests.signalkernel",
              "-f",
              "{connection_file}",
          ],
          "display_name": f"Signal Test Kernel w {provisioner}",
          "env": {"TEST_VARS": "${TEST_VARS}:test_var_2"},
          "metadata": {},
      }
  
      if provisioner:
          kernel_provisioner = {
              "kernel_provisioner": {"provisioner_name": provisioner}
          }
          spec["metadata"].update(kernel_provisioner)
          if provisioner != "local-provisioner":
              spec["metadata"]["kernel_provisioner"]["config"] = {
                  "config_var_1": 42,
                  "config_var_2": name,
              }
  
      kernel_dir = pjoin(paths.jupyter_data_dir(), "kernels", name)
      os.makedirs(kernel_dir)
      with open(pjoin(kernel_dir, "kernel.json"), "w") as f:
          f.write(json.dumps(spec))
  
imports: import asyncio
  import json
  import os
  import signal
  import sys
  from subprocess import PIPE
  from typing import Any, Dict, List, Optional
  import pytest
  from jupyter_core import paths
  from traitlets import Int, Unicode
  from jupyter_client.connect import KernelConnectionInfo
  from jupyter_client.kernelspec import KernelSpecManager, NoSuchKernel
  from jupyter_client.launcher import launch_kernel
  from jupyter_client.manager import AsyncKernelManager
  from jupyter_client.provisioning import KernelProvisionerBase, KernelProvisionerFactory, LocalProvisioner
  from jupyter_client.provisioning.factory import EntryPoint
label_desc: Use image node_id 1 for calling a global function with example usage: build_kernelspec(name, provisioner) without return types