`six.add_metaclass` Decorator's Inner Workings

The `six.add_metaclass` utility functions as a class decorator that dynamically replaces a normally-constructed class with one created using the specified metaclass, adapting its behavior based on whether it's running on Python 2 or Python 3.

Sources

Open the full topic