docstr: enter eventloop
docstr_tok: ["enter","eventloop"]
code: def enter_eventloop(self):
      """enter eventloop"""
      self.log.info("entering eventloop %s", self.eventloop)
      for stream in self.shell_streams:
          # flush any pending replies,
          # which may be skipped by entering the eventloop
          stream.flush(zmq.POLLOUT)
      # restore default_int_handler
      self.pre_handler_hook()
      while self.eventloop is not None:
          try:
              self.eventloop(self)
          except KeyboardInterrupt:
              # Ctrl-C shouldn't crash the kernel
              self.log.error("KeyboardInterrupt caught in kernel")
              continue
          else:
              # eventloop exited cleanly, this means we should stop (right?)
              self.eventloop = None
              break
      self.post_handler_hook()
      self.log.info("exiting eventloop")
  
imports: from __future__ import print_function
  import sys
  import time
  import logging
  import uuid
  from datetime import datetime
  from signal import signal, default_int_handler, SIGINT
  import zmq
  from tornado import ioloop
  from zmq.eventloop.zmqstream import ZMQStream
  from traitlets.config.configurable import SingletonConfigurable
  from IPython.core.error import StdinNotImplementedError
  from ipython_genutils import py3compat
  from ipython_genutils.py3compat import unicode_type, string_types
  from ipykernel.jsonutil import json_clean
  from traitlets import Any, Instance, Float, Dict, List, Set, Integer, Unicode, Bool, observe, default
  from jupyter_client.session import Session
  from ._version import kernel_protocol_version
label_desc: Use image node_id 9 for calling the Kernel obj's underlying member method code with example usage: obj.enter_eventloop() without return types