adopted to python3