code: def write_kernel_spec(
      path=None, overrides=None, extra_arguments=None
  ):
      """Write a kernel spec directory to `path`
  
      If `path` is not specified, a temporary directory is created.
      If `overrides` is given, the kernelspec JSON is updated before writing.
  
      The path to the kernelspec is always returned.
      """
      if path is None:
          path = os.path.join(
              tempfile.mkdtemp(suffix="_kernels"), KERNEL_NAME
          )
  
      # stage resources
      shutil.copytree(RESOURCES, path)
      # write kernel.json
      kernel_dict = get_kernel_dict(extra_arguments)
  
      if overrides:
          kernel_dict.update(overrides)
      with open(pjoin(path, "kernel.json"), "w") as f:
          json.dump(kernel_dict, f, indent=1)
  
      return path
  
file_path: catboost/contrib/python/ipykernel/py2/ipykernel/kernelspec.py
imports: from __future__ import print_function
  import errno
  import json
  import os
  import shutil
  import sys
  import tempfile
  from jupyter_client.kernelspec import KernelSpecManager
  from traitlets.config import Application
label_desc: Use image node_id 3 for calling a global function with example usage: write_kernel_spec(path, overrides, extra_arguments) and returns: path