Returns index / key of the item with the largest value.

    Args:
        input_ (dict or list):

    References:
        http://stackoverflow.com/questions/16945518/python-argmin-argmax

    Ignore:
        list_ = np.random.rand(10000).tolist()
        %timeit list_.index(max(list_))
        %timeit max(enumerate(list_), key=operator.itemgetter(1))[0]
        %timeit max(enumerate(list_), key=lambda x: x[1])[0]
        %timeit max(range(len(list_)), key=list_.__getitem__)

        input_ = dict_
        list_ = np.random.rand(100000).tolist()
        dict_ = {str(ut.random_uuid()): x for x in list_}
        %timeit list(input_.keys())[ut.argmax(list(input_.values()))]
        %timeit max(input_.items(), key=operator.itemgetter(1))[0]

    Example:
        >>> # DISABLE_DOCTEST
        >>> from utool.util_list import *
        >>> import utool as ut
        >>> input_ = [1, 2, 3, 3, 2, 3, 2, 1]
        >>> ut.argmax(input_, multi=True)
        >>> input_ = {1: 4, 2: 2, 3: 3, 3: 4}
        >>> ut.argmax(input_, multi=True)

def argmax(input_, multi=False):
    """
    Returns index / key of the item with the largest value.

    Args:
        input_ (dict or list):

    References:
        http://stackoverflow.com/questions/16945518/python-argmin-argmax

    Ignore:
        list_ = np.random.rand(10000).tolist()
        %timeit list_.index(max(list_))
        %timeit max(enumerate(list_), key=operator.itemgetter(1))[0]
        %timeit max(enumerate(list_), key=lambda x: x[1])[0]
        %timeit max(range(len(list_)), key=list_.__getitem__)

        input_ = dict_
        list_ = np.random.rand(100000).tolist()
        dict_ = {str(ut.random_uuid()): x for x in list_}
        %timeit list(input_.keys())[ut.argmax(list(input_.values()))]
        %timeit max(input_.items(), key=operator.itemgetter(1))[0]

    Example:
        >>> # DISABLE_DOCTEST
        >>> from utool.util_list import *
        >>> import utool as ut
        >>> input_ = [1, 2, 3, 3, 2, 3, 2, 1]
        >>> ut.argmax(input_, multi=True)
        >>> input_ = {1: 4, 2: 2, 3: 3, 3: 4}
        >>> ut.argmax(input_, multi=True)
    """
    if multi:
        if isinstance(input_, dict):
            keys = list(input_.keys())
            values = list(input_.values())
            return [keys[idx] for idx in argmax(values, multi=multi)]
        else:
            return where(equal([max(input_)], input_))
    else:
        if isinstance(input_, dict):
            # its crazy, but this is faster
            # max(input_.items(), key=operator.itemgetter(1))[0]
            return list(input_.keys())[argmax(list(input_.values()))]
        elif hasattr(input_, 'index'):
            return input_.index(max(input_))
        else:
            return max(enumerate(input_), key=operator.itemgetter(1))[0]