class_docstr: A class for managing multiple kernels.
class_docstr_tok: ["A","class","for","managing","multiple","kernels","."]
code: def pre_start_kernel(
      self, kernel_name: str | None, kwargs: t.Any
  ) -> tuple[KernelManager, str, str]:
      # kwargs should be mutable, passing it as a dict argument.
      kernel_id = kwargs.pop("kernel_id", self.new_kernel_id(**kwargs))
      if kernel_id in self:
          raise DuplicateKernelError(
              "Kernel already exists: %s" % kernel_id
          )
  
      if kernel_name is None:
          kernel_name = self.default_kernel_name
      # kernel_manager_factory is the constructor for the KernelManager
      # subclass we are using. It can be configured as any Configurable,
      # including things like its transport and ip.
      constructor_kwargs = {}
      if self.kernel_spec_manager:
          constructor_kwargs[
              "kernel_spec_manager"
          ] = self.kernel_spec_manager
      km = self.kernel_manager_factory(
          connection_file=os.path.join(
              self.connection_dir, "kernel-%s.json" % kernel_id
          ),
          parent=self,
          log=self.log,
          kernel_name=kernel_name,
          **constructor_kwargs,
      )
      return km, kernel_name, kernel_id
  
imports: from __future__ import annotations
  import asyncio
  import json
  import os
  import socket
  import typing
  import uuid
  from functools import wraps
  from pathlib import Path
  import zmq
  from traitlets import Any, Bool, Dict, DottedObjectName, Instance, Unicode, default, observe
  from traitlets.config.configurable import LoggingConfigurable
  from traitlets.utils.importstring import import_item
  from .connect import KernelConnectionInfo
  from .kernelspec import NATIVE_KERNEL_NAME, KernelSpecManager
  from .manager import KernelManager
  from .utils import ensure_async, run_sync, utcnow
label_desc: Use image node_id 11 for calling the MultiKernelManager obj's underlying member method code with example usage: obj.pre_start_kernel(kernel_name, kwargs) and returns: km,  kernel_name,  kernel_id