pymatcher: code reduction