Python 3 adaptation