def generative(func):
    """
    Marks an instance method as generative.
    """
    def wrap(inst, *args, **kw):
        clone = type(inst).__new__(type(inst))
        clone.__dict__ = inst.__dict__.copy()
        return func(clone, *args, **kw)
    return update_wrapper(wrap, func)
Marks an instance method as generative.