def METHOD_NAME(*args, **kwargs):
    """Wrapped NumPy function"""
    tensor_kwargs = {}
    if "requires_grad" in kwargs:
        tensor_kwargs["requires_grad"] = kwargs.pop("requires_grad")
    else:
        tensor_args = list(extract_tensors(args))
        if tensor_args:
            # Unless the user specifies otherwise, if all tensors in the argument
            # list are non-trainable, the output is also non-trainable.
            # Equivalently: if any tensor is trainable, the output is also trainable.
            # NOTE: Use of Python's ``any`` results in an infinite recursion,
            # and I'm not sure why. Using ``np.any`` works fine.
            tensor_kwargs["requires_grad"] = _np.any(
                [i.requires_grad for i in tensor_args]
            )
    # evaluate the original object
    res = obj(*args, **kwargs)
    if isinstance(res, _np.ndarray):
        # only if the output of the object is a ndarray,
        # then convert to a PennyLane tensor
        res = tensor(res, **tensor_kwargs)
    return res