simplified conversion to python3