Adds compatibility with Python 3