Java to python