def grad(func):
    """
    Gradient of the input Function.

    Parameters
    ----------
    func : Function or VectorFunction
    """
    try:
        return func.grad
    except AttributeError:
        raise AttributeError('Gradient not supported for class %s' % func.
            __class__)
