Python code to edit Python structures