Clean up type checking in cursor.py PYTHON-565