https://github.com/bobjansen/patchy-py

Patchy.py allows you to keep define a Python function as the result of another function and a diff.