Converted to python 2/3 compatible code and passed tests