This converts one of the linter scripts to Python. Reference issue: #24783
The approach is to just call git grep using subprocess.run.
Alternative approaches could be to use Python instead of git grep (I’m not sure how) or use pylint --disable=all --enable=W0102
, though that requires installation of pylint.