def extend(instance, new_class):
    """Adds new_class to the ancestors of instance.

    :param instance: Instance that will have a new ancestor.
    :param new_class: Ancestor.
    """
    instance.__class__ = type('%s_extended_with_%s' % (instance.__class__.
        __name__, new_class.__name__), (new_class, instance.__class__), {})
