Mysql While Loop Exit In Python A Namespace