class_docstr: Communicates with a single kernel on any host via zmq channels.
  
  There are five channels associated with each kernel:
  
  * shell: for request/reply calls to the kernel.
  * iopub: for the kernel to publish results to frontends.
  * hb: for monitoring the kernel's heartbeat.
  * stdin: for frontends to reply to raw_input calls in the kernel.
  * control: for kernel management calls to the kernel.
  
  The messages that can be sent on these channels are exposed as methods of the
  client (KernelClient.execute, complete, history, etc.). These methods only
  send the message, they don't wait for a reply. To get results, use e.g.
  :meth:`get_shell_msg` to fetch messages from the shell channel.
docstr: Request an immediate kernel shutdown on the control channel.
  
  Upon receipt of the (empty) reply, client code can safely assume that
  the kernel has shut down and it's safe to forcefully terminate it if
  it's still alive.
  
  The kernel will send the reply via a function registered with Python's
  atexit module, ensuring it's truly done as the kernel is done with all
  normal operation.
  
  Returns
  -------
  The msg_id of the message sent
docstr_tok: ["Request","an","immediate","kernel","shutdown","on","the","control","channel",".","Upon","receipt","of","the","(","empty",")","reply",",","client","code","can","safely","assume","that","the","kernel","has","shut","down","and","it","'s","safe","to","forcefully","terminate","it","if","it","'s","still","alive",".","The","kernel","will","send","the","reply","via","a","function","registered","with","Python's","atexit","module",",","ensuring","it","'s","truly","done","as","the","kernel","is","done","with","all","normal","operation",".","Returns","--","--","--","-","The","msg_id","of","the","message","sent"]
code: def shutdown(self, restart: bool = False) -> str:
      """Request an immediate kernel shutdown on the control channel.
  
      Upon receipt of the (empty) reply, client code can safely assume that
      the kernel has shut down and it's safe to forcefully terminate it if
      it's still alive.
  
      The kernel will send the reply via a function registered with Python's
      atexit module, ensuring it's truly done as the kernel is done with all
      normal operation.
  
      Returns
      -------
      The msg_id of the message sent
      """
      # Send quit message to kernel. Once we implement kernel-side setattr,
      # this should probably be done that way, but for now this will do.
      msg = self.session.msg("shutdown_request", {"restart": restart})
      self.control_channel.send(msg)
      return msg["header"]["msg_id"]
  
imports: import asyncio
  import inspect
  import sys
  import time
  import typing
  from functools import partial
  from getpass import getpass
  from queue import Empty
  import zmq.asyncio
  from jupyter_core.utils import ensure_async
  from traitlets import Any, Bool, Instance, Type
  from .channels import major_protocol_version
  from .channelsabc import ChannelABC, HBChannelABC
  from .clientabc import KernelClientABC
  from .connect import ConnectionFileMixin
  from .session import Session
label_desc: Use image node_id 22 for calling the KernelClient obj's underlying member method code with example usage: obj.shutdown(restart) and returns: msg