You need to specify diff format, so that Git can correctly identify and parse function body.
*.py diff=python
Thanks!