def bind_kernel(self, **kwargs):
if self.kernel_app is not None:<EOL><INDENT>return<EOL><DEDENT>self.log.info("<STR_LIT>")<EOL>kernel = self.kernel<EOL>kwargs.setdefault('<STR_LIT>', self.config)<EOL>kwargs.setdefault('<STR_LIT>', self.log)<EOL>kwargs.setdefault('<STR_LIT>', self.profile_dir)<EOL>kwargs.setdefault('<STR_LIT>', self.engine.session)<EOL>app = self.kernel_app = IPKernelApp(**kwargs)<EOL>IPKernelApp._instance = app<EOL>app.init_connection_file()<EOL>app.shell_port = app._bind_socket(kernel.shell_streams[<NUM_LIT:0>], app.shell_port)<EOL>app.log.debug("<STR_LIT>", app.shell_port)<EOL>app.iopub_port = app._bind_socket(kernel.iopub_socket, app.iopub_port)<EOL>app.log.debug("<STR_LIT>", app.iopub_port)<EOL>kernel.stdin_socket = self.engine.context.socket(zmq.ROUTER)<EOL>app.stdin_port = app._bind_socket(kernel.stdin_socket, app.stdin_port)<EOL>app.log.debug("<STR_LIT>", app.stdin_port)<EOL>app.init_heartbeat()<EOL>app.log_connection_info()<EOL>app.write_connection_file()<EOL>
Promote engine to listening kernel, accessible to frontends.