code: def _install_kernel(name="problemtest", extra_env=None):
      if extra_env is None:
          extra_env = {}
      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(
                  {
                      "argv": [
                          sys.executable,
                          "-m",
                          "tests.problemkernel",
                          "-f",
                          "{connection_file}",
                      ],
                      "display_name": "Problematic Test Kernel",
                      "env": {
                          "TEST_VARS": "${TEST_VARS}:test_var_2",
                          **extra_env,
                      },
                  }
              )
          )
      return name
  
file_path: jupyter_client/tests/test_restarter.py
imports: import asyncio
  import json
  import os
  import sys
  from concurrent.futures import Future
  import pytest
  from jupyter_core import paths
  from traitlets.config.loader import Config
  from traitlets.log import get_logger
  from jupyter_client.ioloop import AsyncIOLoopKernelManager, IOLoopKernelManager
label_desc: Use image node_id 1 for calling a global function with example usage: _install_kernel(name, extra_env) and returns: name