Ensures that the function is wrapped in a ScriptAdaptor
        object.  If it is not, a new ScriptAdaptor will be returned.
        If it is, the ScriptAdaptor is returned.

        :param func: The function to be wrapped.

def _wrap(cls, func):
        """
        Ensures that the function is wrapped in a ScriptAdaptor
        object.  If it is not, a new ScriptAdaptor will be returned.
        If it is, the ScriptAdaptor is returned.

        :param func: The function to be wrapped.
        """

        if isinstance(func, cls):
            return func
        return functools.update_wrapper(cls(func), func)