code: def wait_for_event(self, emptybuffer=False):
          
          if emptybuffer:
              while self._wait(0):
                  self._read()
          while self._wait():
              event = self._read()
              if event:
                  return event
docs: Waits until a joystick event becomes available.  Returns the event, as
          an `InputEvent` tuple.
  
          If *emptybuffer* is `True` (it defaults to `False`), any pending
          events will be thrown away first. This is most useful if you are only
          interested in "pressed" events.