It's less clear the way it's done but the error arose notThe implementation chosen (try..except) is less clear that often so... (2 times so far)n checking for the pattern.
I avoid comparing strings andBut that error being not frequent., 2 times so far, I prefer catchavoidinging the error if anystring comparison.
Shout out if you disagree ;)
Related https://sentry.softwareheritage.org/share/issue/518b76d7d7d244f8b88d1757599035b2/