replace java to python