parameters: (self, listener)
docstring: listener is a dict in witch there are a sessions_id and a dict of device_identifier to listen
docstring_summary: listener is a dict in witch there are a sessions_id and a dict of device_identifier to listen
docstring_tokens: listener is a dict in witch there are a sessions_id and a dict of device_identifier to listen
function: def event(self, listener):
          """
          listener is a dict in witch there are a sessions_id and a dict of device_identifier to listen
          """
          req = event_manager.add_request(listener)
  
          # Search for previous events and remove events older than 5 seconds
          oldest_time = time.time() - 5
          for event in list(event_manager.events):
              if event['time'] < oldest_time:
                  del event_manager.events[0]
                  continue
              if event['device_identifier'] in listener['devices'] and event['time'] > listener['last_event']:
                  event['session_id'] = req['session_id']
                  return event
  
          # Wait for new event
          if req['event'].wait(50):
              req['event'].clear()
              req['result']['session_id'] = req['session_id']
              return req['result']
function_tokens: def event ( self , listener ) : req = event_manager . add_request ( listener ) # Search for previous events and remove events older than 5 seconds oldest_time = time . time ( ) - 5 for event in list ( event_manager . events ) : if event [ 'time' ] < oldest_time : del event_manager . events [ 0 ] continue if event [ 'device_identifier' ] in listener [ 'devices' ] and event [ 'time' ] > listener [ 'last_event' ] : event [ 'session_id' ] = req [ 'session_id' ] return event # Wait for new event if req [ 'event' ] . wait ( 50 ) : req [ 'event' ] . clear ( ) req [ 'result' ] [ 'session_id' ] = req [ 'session_id' ] return req [ 'result' ]