'Return the next message in a one-time iteration.'

def next(self):

    if (not hasattr(self, '_onetime_keys')):
        self._onetime_keys = self.iterkeys()
    while True:
        try:
            return self[self._onetime_keys.next()]
        except StopIteration:
            return None
        except KeyError:
            continue
