Make python 3 compatible

Additional changes to make flask-peewee work with Python 3.  This is a dependency of the recent PR for wtf-peewee: https://github.com/duncaningram/wtf-peewee/tree/python3