how do i check if an insert was successful with mysqldb in python?,cursor.close()