models.py made exception python2/3 compatible