Improving Python code.