class_docstr: :param recognize_paste: When True, try to discover paste actions and turn
      the event into a BracketedPaste.
class_docstr_tok: [":","param","recognize_paste",":","When","True",",","try","to","discover","paste","actions","and","turn","the","event","into","a","BracketedPaste","."]
docstr: For this `KEY_EVENT_RECORD`, return a list of `KeyPress` instances.
docstr_tok: ["For","this","`","KEY_EVENT_RECORD","`",",","return","a","list","of","`","KeyPress","`","instances","."]
code: def _event_to_key_presses(self, ev):
      """
      For this `KEY_EVENT_RECORD`, return a list of `KeyPress` instances.
      """
      assert type(ev) == KEY_EVENT_RECORD and ev.KeyDown
  
      result = None
  
      u_char = ev.uChar.UnicodeChar
      ascii_char = u_char.encode("utf-8")
  
      # NOTE: We don't use `ev.uChar.AsciiChar`. That appears to be latin-1
      #       encoded. See also:
      # https://github.com/ipython/ipython/issues/10004
      # https://github.com/jonathanslenders/python-prompt-toolkit/issues/389
  
      if u_char == "\x00":
          if ev.VirtualKeyCode in self.keycodes:
              result = KeyPress(self.keycodes[ev.VirtualKeyCode], "")
      else:
          if ascii_char in self.mappings:
              if self.mappings[ascii_char] == Keys.ControlJ:
                  u_char = "\n"  # Windows sends \n, turn into \r for unix compatibility.
              result = KeyPress(self.mappings[ascii_char], u_char)
          else:
              result = KeyPress(u_char, u_char)
  
      # Correctly handle Control-Arrow keys.
      if (
          ev.ControlKeyState & self.LEFT_CTRL_PRESSED
          or ev.ControlKeyState & self.RIGHT_CTRL_PRESSED
      ) and result:
          if result.key == Keys.Left:
              result.key = Keys.ControlLeft
  
          if result.key == Keys.Right:
              result.key = Keys.ControlRight
  
          if result.key == Keys.Up:
              result.key = Keys.ControlUp
  
          if result.key == Keys.Down:
              result.key = Keys.ControlDown
  
      # Turn 'Tab' into 'BackTab' when shift was pressed.
      if ev.ControlKeyState & self.SHIFT_PRESSED and result:
          if result.key == Keys.Tab:
              result.key = Keys.BackTab
  
      # Turn 'Space' into 'ControlSpace' when control was pressed.
      if (
          (
              ev.ControlKeyState & self.LEFT_CTRL_PRESSED
              or ev.ControlKeyState & self.RIGHT_CTRL_PRESSED
          )
          and result
          and result.data == " "
      ):
          result = KeyPress(Keys.ControlSpace, " ")
  
      # Turn Control-Enter into META-Enter. (On a vt100 terminal, we cannot
      # detect this combination. But it's really practical on Windows.)
      if (
          (
              ev.ControlKeyState & self.LEFT_CTRL_PRESSED
              or ev.ControlKeyState & self.RIGHT_CTRL_PRESSED
          )
          and result
          and result.key == Keys.ControlJ
      ):
          return [KeyPress(Keys.Escape, ""), result]
  
      # Return result. If alt was pressed, prefix the result with an
      # 'Escape' key, just like unix VT100 terminals do.
  
      # NOTE: Only replace the left alt with escape. The right alt key often
      #       acts as altgr and is used in many non US keyboard layouts for
      #       typing some special characters, like a backslash. We don't want
      #       all backslashes to be prefixed with escape. (Esc-\ has a
      #       meaning in E-macs, for instance.)
      if result:
          meta_pressed = ev.ControlKeyState & self.LEFT_ALT_PRESSED
  
          if meta_pressed:
              return [KeyPress(Keys.Escape, ""), result]
          else:
              return [result]
  
      else:
          return []
  
imports: from __future__ import unicode_literals
  from ctypes import windll, pointer
  from ctypes.wintypes import DWORD, HANDLE
  from six.moves import range
  from prompt_toolkit.key_binding.input_processor import KeyPress
  from prompt_toolkit.keys import Keys
  from prompt_toolkit.mouse_events import MouseEventType
  from prompt_toolkit.win32_types import EventTypes, KEY_EVENT_RECORD, MOUSE_EVENT_RECORD, INPUT_RECORD, STD_INPUT_HANDLE
  import msvcrt
  import os
  import sys
  import six
label_desc: Use image node_id 6 for calling the ConsoleInputReader obj's underlying member method code with example usage: obj._event_to_key_presses(ev) and returns: list, list, list, list