The [Schema python library](https://github.com/keleshev/schema) may be interesting to look into and might have helper functions worth checking out