How to use Python decorators to modify functions with other functions, simplifying complex code