adjust excepts to work with python2 and python3