Persistent queue implementation in python