stackoverflow.com/a/75307780 I don't have 3.10 installed to test, so I'd appreciate review, feedback for caveats, etc. For example I'm pretty sure this only works to test against constants, since trying to test against variables would instead capture parts of the matched pattern. would appreciate some examples of what happens when trying that.