import functools


def _wrap(wrappercls, func):
    """
    Return wrapped function.

    Used to ensure that decorated nut function has the correct docstring.

    :param class wrappercls: Nut wrapper class
    :param function func: Function to wrap
    :return: Wrapped function
    :rtype: function
    """
    @functools.wraps(func)
    def wrapper(*args, **kwds):
        return wrappercls(*args, **kwds)

    return wrapper