Python utility code for db (mysqldb) operations