implementation of a bounded queue in python