code: def waitAndGet(self, event_name, timeout=DEFAULT_TIMEOUT):
          
          if timeout:
              if timeout > MAX_TIMEOUT:
                  raise Error(
                      self._ad,
                      'Specified timeout %s is longer than max timeout %s.' %
                      (timeout, MAX_TIMEOUT))
          # Convert to milliseconds for java side.
          timeout_ms = int(timeout * 1000)
          try:
              raw_event = self._event_client.eventWaitAndGet(
                  self._id, event_name, timeout_ms)
          except Exception as e:
              if 'EventSnippetException: timeout.' in str(e):
                  raise TimeoutError(
                      self._ad,
                      'Timed out after waiting %ss for event "%s" triggered by'
                      ' %s (%s).' % (timeout, event_name, self._method_name,
                                     self._id))
              raise
          return snippet_event.from_dict(raw_event)
docs: Blocks until an event of the specified name has been received and
          return the event, or timeout.
  
          Args:
              event_name: string, name of the event to get.
              timeout: float, the number of seconds to wait before giving up.
  
          Returns:
              SnippetEvent, the oldest entry of the specified event.
  
          Raises:
              Error: If the specified timeout is longer than the max timeout
                  supported.
              TimeoutError: The expected event does not occur within time limit.