made exception python2/3 compatible