'Dequeue and return a record.'

def dequeue(self, block):

    if block:
        s = self.queue.blpop(self.key)[1]
    else:
        s = self.queue.lpop(self.key)
    if (not s):
        record = None
    else:
        record = pickle.loads(s)
    return record
