def mirror_from(source, attributes, only_getters=True):
    """Decorator (factory) for classes that mirror some attributes from an
    instance variable.

    :param source: the name of the instance variable to mirror from
    :param attributes: list of attribute names to mirror
    :param only_getters: if true only getters but not setters are created
    """
    def decorator(cls):
        for attribute in attributes:
            def make_gs_etter(source, attribute):
                def getter(self):
                    return getattr(getattr(self, source), attribute)

                def setter(self, value):
                    setattr(getattr(self, source), attribute, value)
                return getter, setter
            getter, setter = make_gs_etter(source, attribute)
            if only_getters:
                setattr(cls, attribute, property(getter))
            else:
                setattr(cls, attribute, property(getter, setter))
        return cls
    return decorator