Python code changes