Migration from python 3 to 2.7