class_docstr: Statemachine that receives :class:`KeyPress` instances and according to the
  key bindings in the given :class:`KeyBindings`, calls the matching handlers.
  
  ::
  
      p = KeyProcessor(key_bindings)
  
      # Send keys into the processor.
      p.feed(KeyPress(Keys.ControlX, ''))
      p.feed(KeyPress(Keys.ControlC, '')
  
      # Process all the keys in the queue.
      p.process_keys()
  
      # Now the ControlX-ControlC callback will be called if this sequence is
      # registered in the key bindings.
  
  :param key_bindings: `KeyBindingsBase` instance.
code: def _call_handler(
      self, handler: Binding, key_sequence: list[KeyPress]
  ) -> None:
      app = get_app()
      was_recording_emacs = app.emacs_state.is_recording
      was_recording_vi = bool(app.vi_state.recording_register)
      was_temporary_navigation_mode = (
          app.vi_state.temporary_navigation_mode
      )
      arg = self.arg
      self.arg = None
  
      event = KeyPressEvent(
          weakref.ref(self),
          arg=arg,
          key_sequence=key_sequence,
          previous_key_sequence=self._previous_key_sequence,
          is_repeat=(handler == self._previous_handler),
      )
  
      # Save the state of the current buffer.
      if handler.save_before(event):
          event.app.current_buffer.save_to_undo_stack()
  
      # Call handler.
      from prompt_toolkit.buffer import EditReadOnlyBuffer
  
      try:
          handler.call(event)
          self._fix_vi_cursor_position(event)
  
      except EditReadOnlyBuffer:
          # When a key binding does an attempt to change a buffer which is
          # read-only, we can ignore that. We sound a bell and go on.
          app.output.bell()
  
      if was_temporary_navigation_mode:
          self._leave_vi_temp_navigation_mode(event)
  
      self._previous_key_sequence = key_sequence
      self._previous_handler = handler
  
      # Record the key sequence in our macro. (Only if we're in macro mode
      # before and after executing the key.)
      if handler.record_in_macro():
          if app.emacs_state.is_recording and was_recording_emacs:
              recording = app.emacs_state.current_recording
              if (
                  recording is not None
              ):  # Should always be true, given that
                  # `was_recording_emacs` is set.
                  recording.extend(key_sequence)
  
          if app.vi_state.recording_register and was_recording_vi:
              for k in key_sequence:
                  app.vi_state.current_recording += k.data
  
imports: from __future__ import annotations
  import weakref
  from asyncio import Task, sleep
  from collections import deque
  from typing import TYPE_CHECKING, Any, Generator
  from prompt_toolkit.application.current import get_app
  from prompt_toolkit.enums import EditingMode
  from prompt_toolkit.filters.app import vi_navigation_mode
  from prompt_toolkit.keys import Keys
  from prompt_toolkit.utils import Event
  from .key_bindings import Binding, KeyBindingsBase
label_desc: Use image node_id 10 for calling the KeyProcessor obj's underlying member method code with example usage: obj._call_handler(handler, key_sequence) without return types