def getNextUnprocessedEventId(self):
    if self._lastEventId:
        nextId = (self._lastEventId + 1)
    else:
        nextId = None
    now = datetime.datetime.now()
    for k in list(self._backlog):
        v = self._backlog[k]
        if (v < now):
            self.logger.warning('Timeout elapsed on backlog event id %d.', k)
            del self._backlog[k]
        elif ((nextId is None) or (k < nextId)):
            nextId = k
    return nextId
def getNextUnprocessedEventId(self):
    if self._lastEventId:
        nextId = (self._lastEventId + 1)
    else:
        nextId = None
    now = datetime.datetime.now()
    for k in list(self._backlog):
        v = self._backlog[k]
        if (v < now):
            self.logger.warning('Timeout elapsed on backlog event id %d.', k)
            del self._backlog[k]
        elif ((nextId is None) or (k < nextId)):
            nextId = k
    return nextId