fixed the python code