Python When To Use Nested Functions Mysql Command Not Found