'Retrieves the items from the queue.'

def Get(self):

    with self.lock:
        if self._reversed:
            self._reversed.reverse()
            self.queue = (self._reversed + self.queue)
        self.queue.sort(key=(lambda msg: msg[0]))
        self.queue.reverse()
        (self._reversed, self.queue) = (self.queue, [])
        while self._reversed:
            item = self._reversed.pop()[1]
            self.total_size -= len(item)
            (yield item)
