Ported automatically to python3