def new_wrapper(wrapper, model):
 if isinstance(model, dict):
  infodict = model
 else:
  infodict = getinfo(model)
 assert (not ('_wrapper_' in infodict['argnames'])), '"_wrapper_" is a reserved argument name!'
 src = ('lambda %(signature)s: _wrapper_(%(signature)s)' % infodict)
 funcopy = eval(src, dict(_wrapper_=wrapper))
 return update_wrapper(funcopy, model, infodict)

def new_wrapper ( wrapper , model ) : if isinstance ( model , dict ) : infodict = model else : infodict = getinfo ( model ) assert ( not ( '_wrapper_' in infodict [ 'argnames' ] ) ) , '"_wrapper_" is a reserved argument name!' src = ( 'lambda %(signature)s: _wrapper_(%(signature)s)' % infodict ) funcopy = eval ( src , dict ( _wrapper_ = wrapper ) ) return update_wrapper ( funcopy , model , infodict )
an improvement over functools .