class_docstr: Manages a single kernel in a subprocess on this host.
  
  This version starts kernels with Popen.
class_docstr_tok: ["Manages","a","single","kernel","in","a","subprocess","on","this","host",".","This","version","starts","kernels","with","Popen","."]
docstr: Clean up resources when the kernel is shut down
docstr_tok: ["Clean","up","resources","when","the","kernel","is","shut","down"]
code: def cleanup(self, connection_file=True):
      """Clean up resources when the kernel is shut down"""
      if connection_file:
          self.cleanup_connection_file()
  
      self.cleanup_ipc_files()
      self._close_control_socket()
  
imports: from __future__ import absolute_import
  from contextlib import contextmanager
  import os
  import re
  import signal
  import sys
  import time
  import warnings
  import zmq
  from ipython_genutils.importstring import import_item
  from .localinterfaces import is_local_ip, local_ips
  from traitlets import Any, Float, Instance, Unicode, List, Bool, Type, DottedObjectName
  from jupyter_client import launch_kernel, kernelspec
  from .connect import ConnectionFileMixin
  from .managerabc import KernelManagerABC
label_desc: Use image node_id 23 for calling the KernelManager obj's underlying member method code with example usage: obj.cleanup(connection_file) without return types