Some compatibility stuff for python 3 added