def wrapper(fn):
        """
        The actual decorator returned by modify_class, which actually modifies the class.
        
        @param fn: the function to decorate
        @return: the argument function.
        """
        if name is None:
            name_ = fn.__name__
        else:
            name_ = name
        original_method = getattr(cls,name_,default)
        new_method = fn(original_method)
        setattr(cls,name_,new_method)
        return fn

        The actual decorator returned by modify_class, which actually modifies the class.
        
        @param fn: the function to decorate
        @return: the argument function.
        
recipes/Python/577628_Dynamically_modifying_class_attributes_at/recipe-577628.py