def invdist(d):
    """
    Inverse distance kernel.

    Parameters
    ----------
    d : ndarray, shape (N,) or (M,N)
        One- or two-dimensional array of distances

    Returns
    -------
    ndarray, shape (N,) or (M,N)
        Inverse distance, i.e. d^{-1}

    Raises
    ------
    ZeroDivisionError : `d` includes zero value
    TypeError : `d` is not array_like

    """
    try:
        return 1. / d
    except ZeroDivisionError as e:
        raise ZeroDivisionError(e)
    except AttributeError:
        raise TypeError("expected array_like, got {}".format(type(d)))