See https://github.com/pydantic/pydantic/discussions/3303. We should allow the descriminator to be a regex or function.