cursor.py proxy/ref cleanup to match mysqlclient