code: def get_kernel_spec(kernel_name: str) -> KernelSpec:
      """Returns a :class:`KernelSpec` instance for the given kernel_name.
  
      Raises KeyError if the given kernel name is not found.
      """
      return KernelSpecManager().get_kernel_spec(kernel_name)
  
imports: from __future__ import annotations
  import json
  import os
  import re
  import shutil
  import typing
  import warnings
  from jupyter_core.paths import SYSTEM_JUPYTER_PATH, jupyter_data_dir, jupyter_path
  from traitlets import Bool, CaselessStrEnum, Dict, HasTraits, List, Set, Type, Unicode, observe
  from traitlets.config import LoggingConfigurable
  from .provisioning import KernelProvisionerFactory
label_desc: Use image node_id 5 for calling a global function with example usage: get_kernel_spec(kernel_name) and returns: KernelSpecManager