

def shutdown_kernel(self, restart=False):
    ' Attempts to the stop the kernel process cleanly. If the kernel\n        cannot be stopped, it is killed, if possible.\n        '
    if (sys.platform == 'win32'):
        self.kill_kernel()
        return
    self.xreq_channel.shutdown(restart=restart)
    for i in range(10):
        if self.is_alive:
            time.sleep(0.1)
        else:
            break
    else:
        if self.has_kernel:
            self.kill_kernel()

dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/engine/kernelstarter.py KernelStarter.shutdown_kernel/original