def tupled_argmax(a):
    """
    Argmax that returns an index tuple. Note that `numpy.argmax` will return a
    scalar index as if you had flattened the array.

    Parameters
    ----------
    a : array_like
        Input array.

    Returns
    -------
    index : tuple
        Tuple of index, even if `a` is one-dimensional. Note that this can
        immediately be used to index `a` as in ``a[index]``.

    Examples
    --------
    >>> import numpy as np
    >>> import deepdish as dd
    >>> a = np.arange(6).reshape(2,3)
    >>> a
    array([[0, 1, 2],
           [3, 4, 5]])
    >>> dd.tupled_argmax(a)
    (1, 2)
    """
    return np.unravel_index(np.argmax(a), np.shape(a))