Remove trailing white spaces from all *.py files under dir directory (ignoring .git path) and keep backups of the originals
find dir -not -path '.git' -iname '*.py' -print0 | xargs -0 sed --in-place=.bak 's/[[:space:]]*$//'.