Circular buffer for Python