Made compatible with Python 2 and Python 3