Running mypy on the functional tests folder raises this error:
test/functional/test_framework/cdefs.py:65: error: Item "None" of "Optional[Match[str]]" has no attribute "group"
This is caused by the fact that re.match may return None if the regex
doesn't match. Adding an explicit test for match is None catches such
situations and allows to print a more useful error message.