tools/check_patch.py: minor improvements

Some simple improvements/fixes. See description on each commit.

I plan to synchronize the `check_patch.py` version on Autotest's repo as soon as this gets committed.