def mixin(obj, *mixins):
    """
    Function adding one or more mixin class to the list of parent classes of the current object.
    This is done by dynamically changing the class hierarchy of the current object,
    not only by adding the mixin methods to the object.

    :param obj: the object on which to apply the mixins.
    :param mixins: the list of mixin classes to add to the object.
    :return: the extended object.
    """
    obj.__class__ = type(obj.__class__.__name__, (obj.__class__,) + tuple(
        mixins), dict())
    return obj
