It does not make sense everywhere, but where you want to check the message string use this variant. It's a bit of reduplication but I don't see a nice way of merging this into the other function due to the args and kwargs