Tried to make it work on Python 2 and 3