code: def read(self):
          
          max_count = 2048  # Max events to read at the same time.
  
          read = DWORD(0)
          arrtype = INPUT_RECORD * max_count
          input_records = arrtype()
  
          # Get next batch of input event.
          windll.kernel32.ReadConsoleInputW(
              self.handle, pointer(input_records), max_count, pointer(read))
  
          # First, get all the keys from the input buffer, in order to determine
          # whether we should consider this a paste event or not.
          all_keys = list(self._get_keys(read, input_records))
  
          if self.recognize_paste and self._is_paste(all_keys):
              gen = iter(all_keys)
              for k in gen:
                  # Pasting: if the current key consists of text or \n, turn it
                  # into a BracketedPaste.
                  data = []
                  while k and (isinstance(k.key, six.text_type) or
                               k.key == Keys.ControlJ):
                      data.append(k.data)
                      try:
                          k = next(gen)
                      except StopIteration:
                          k = None
  
                  if data:
                      yield KeyPress(Keys.BracketedPaste, ''.join(data))
                  if k is not None:
                      yield k
          else:
              for k in all_keys:
                  yield k
docs: Return a list of `KeyPress` instances. It won't return anything when
          there was nothing to read.  (This function doesn't block.)
  
          http://msdn.microsoft.com/en-us/library/windows/desktop/ms684961(v=vs.85).aspx