def takeSomeFromQueue(self):
    def yield_max_datapoints():
      for count in range(settings.MAX_DATAPOINTS_PER_MESSAGE):
        try:
          yield self.queue.popleft()
        except IndexError:
          raise StopIteration
    return list(yield_max_datapoints())
Use self.queue, which is a collections.deque, to pop up to
dataset/ETHPy150Open graphite-project/carbon/lib/carbon/client.py/CarbonClientFactory.takeSomeFromQueue