Python supports metaclasses, i.e., classes that control the creation of other classes.
Although this feature should not be overused, it can be useful in some circumstances.
See the following article for a discussion.
metaclasses.ipynb: Jupyter notebook illustrating using a metaclass to verify the correct implementation of a mix-in.