Make cursors work for Python 3.x. Add test suite for cursors.