Add compatibility with python 3