def wrap_callable(wrapper, fn):
 if hasattr(fn, '__name__'):
  return update_wrapper(wrapper, fn)
 else:
  _f = wrapper
  _f.__name__ = fn.__class__.__name__
  if hasattr(fn, '__module__'):
   _f.__module__ = fn.__module__
  if (hasattr(fn.__call__, '__doc__') and fn.__call__.__doc__):
   _f.__doc__ = fn.__call__.__doc__
  elif fn.__doc__:
   _f.__doc__ = fn.__doc__
  return _f

def wrap_callable ( wrapper , fn ) : if hasattr ( fn , '__name__' ) : return update_wrapper ( wrapper , fn ) else : _f = wrapper _f . __name__ = fn . __class__ . __name__ if hasattr ( fn , '__module__' ) : _f . __module__ = fn . __module__ if ( hasattr ( fn . __call__ , '__doc__' ) and fn . __call__ . __doc__ ) : _f . __doc__ = fn . __call__ . __doc__ elif fn . __doc__ : _f . __doc__ = fn . __doc__ return _f
augment functools .