code: def handle_input(self, ncode, wparam, lparam):
          
          value = WIN_KEYBOARD_CODES[wparam]
          scan_code = lparam.contents.scan_code
          vk_code = lparam.contents.vk_code
          self.update_timeval()
  
          events = []
          # Add key event
          scan_key, key_event = self.emulate_press(
              vk_code, scan_code, value, self.timeval)
          events.append(scan_key)
          events.append(key_event)
  
          # End with a sync marker
          events.append(self.sync_marker(self.timeval))
  
          # We are done
          self.write_to_pipe(events)
  
          return ctypes.windll.user32.CallNextHookEx(
              self.hooked, ncode, wparam, lparam)
docs: Process the key input.