def __getattr__(self, attr):
    if attr == 'foo':
        result = foo()
res_type = type(result)
wrapper_dict = res_type.__dict__.copy()
wrapper_dict['__doc__'] = foo.__doc__
doc for __getattr__ defined attributes