docstr: handle an execute_request
docstr_tok: ["handle","an","execute_request"]
code: def execute_request(self, stream, ident, parent):
      """handle an execute_request"""
  
      try:
          content = parent["content"]
          code = py3compat.cast_unicode_py2(content["code"])
          silent = content["silent"]
          store_history = content.get("store_history", not silent)
          user_expressions = content.get("user_expressions", {})
          allow_stdin = content.get("allow_stdin", False)
      except:
          self.log.error("Got bad msg: ")
          self.log.error("%s", parent)
          return
  
      stop_on_error = content.get("stop_on_error", True)
  
      metadata = self.init_metadata(parent)
  
      # Re-broadcast our input for the benefit of listening clients, and
      # start computing output
      if not silent:
          self.execution_count += 1
          self._publish_execute_input(
              code, parent, self.execution_count
          )
  
      reply_content = self.do_execute(
          code, silent, store_history, user_expressions, allow_stdin
      )
  
      # Flush output before sending the reply.
      sys.stdout.flush()
      sys.stderr.flush()
      # FIXME: on rare occasions, the flush doesn't seem to make it to the
      # clients... This seems to mitigate the problem, but we definitely need
      # to better understand what's going on.
      if self._execute_sleep:
          time.sleep(self._execute_sleep)
  
      # Send the reply.
      reply_content = json_clean(reply_content)
      metadata = self.finish_metadata(parent, metadata, reply_content)
  
      reply_msg = self.session.send(
          stream,
          "execute_reply",
          reply_content,
          parent,
          metadata=metadata,
          ident=ident,
      )
  
      self.log.debug("%s", reply_msg)
  
      if (
          not silent
          and reply_msg["content"]["status"] == "error"
          and stop_on_error
      ):
          self._abort_queues()
  
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 19 for calling the Kernel obj's underlying member method code with example usage: obj.execute_request(stream, ident, parent) without return types