code: def _get_keys(self, read, input_records):
          
          for i in range(read.value):
              ir = input_records[i]
  
              # Get the right EventType from the EVENT_RECORD.
              # (For some reason the Windows console application 'cmder'
              # [http://gooseberrycreative.com/cmder/] can return '0' for
              # ir.EventType. -- Just ignore that.)
              if ir.EventType in EventTypes:
                  ev = getattr(ir.Event, EventTypes[ir.EventType])
  
                  # Process if this is a key event. (We also have mouse, menu and
                  # focus events.)
                  if type(ev) == KEY_EVENT_RECORD and ev.KeyDown:
                      for key_press in self._event_to_key_presses(ev):
                          yield key_press
  
                  elif type(ev) == MOUSE_EVENT_RECORD:
                      for key_press in self._handle_mouse(ev):
                          yield key_press
docs: Generator that yields `KeyPress` objects from the input records.