refactoring with the python spirit