def _set_attribute_func(function, attribute, value):
 orig_func = function
 while isinstance(orig_func, partial):
  orig_func = orig_func.func
 setattr(orig_func, attribute, value)

def _set_attribute_func ( function , attribute , value ) : orig_func = function while isinstance ( orig_func , partial ) : orig_func = orig_func . func setattr ( orig_func , attribute , value )
helper to set attributes to func and methods .