you could use the decorator @wraps from functools to help decorating the wrap function. In this way inspection and docstring of the original function would be preserved.