code: def _abort_queue(self, stream):
      poller = zmq.Poller()
      poller.register(stream.socket, zmq.POLLIN)
      while True:
          idents, msg = self.session.recv(
              stream, zmq.NOBLOCK, content=True
          )
          if msg is None:
              return
  
          self.log.info("Aborting:")
          self.log.info("%s", msg)
          msg_type = msg["header"]["msg_type"]
          reply_type = msg_type.split("_")[0] + "_reply"
  
          status = {"status": "aborted"}
          md = {"engine": self.ident}
          md.update(status)
          self._publish_status("busy", parent=msg)
          reply_msg = self.session.send(
              stream,
              reply_type,
              metadata=md,
              content=status,
              parent=msg,
              ident=idents,
          )
          self._publish_status("idle", parent=msg)
          self.log.debug("%s", reply_msg)
          # We need to wait a bit for requests to come in. This can probably
          # be set shorter for true asynchronous clients.
          poller.poll(50)
  
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 42 for calling the Kernel obj's underlying member method code with example usage: obj._abort_queue(stream) without return types