If it's worth sharing it's worth to accompany the blog post with a repo containing unittests and tox.ini and pre-commit
If that had been done, tox would give feedback that match switch support is py310+
functools.singledispatch
might be helpful to test multiple implementations
Complaint about sharing code within a blog post is the quality is ALWAYS suspect.
Lets leave crapoverflow.com style code examples in the past. Instead share tested code.