code: def stash_state():
      
      # TODO: stash caps lock / numlock /scrollock state.
      with _pressed_events_lock:
          state = sorted(_pressed_events)
      for scan_code in state:
          _os_keyboard.release(scan_code)
      return state
docs: Builds a list of all currently pressed scan codes, releases them and returns
      the list. Pairs well with `restore_state` and `restore_modifiers`.