groups indicies of each item in ``groupid_list``

    Args:
        groupid_list (list): list of group ids

    SeeAlso:
        vt.group_indices - optimized numpy version
        ut.apply_grouping

    CommandLine:
        python -m utool.util_alg --test-group_indices
        python3 -m utool.util_alg --test-group_indices

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_alg import *  # NOQA
        >>> import utool as ut
        >>> groupid_list = ['b', 1, 'b', 1, 'b', 1, 'b', 'c', 'c', 'c', 'c']
        >>> (keys, groupxs) = ut.group_indices(groupid_list)
        >>> result = ut.repr3((keys, groupxs), nobraces=1, nl=1)
        >>> print(result)
        [1, 'b', 'c'],
        [[1, 3, 5], [0, 2, 4, 6], [7, 8, 9, 10]],

def group_indices(groupid_list):
    """
    groups indicies of each item in ``groupid_list``

    Args:
        groupid_list (list): list of group ids

    SeeAlso:
        vt.group_indices - optimized numpy version
        ut.apply_grouping

    CommandLine:
        python -m utool.util_alg --test-group_indices
        python3 -m utool.util_alg --test-group_indices

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_alg import *  # NOQA
        >>> import utool as ut
        >>> groupid_list = ['b', 1, 'b', 1, 'b', 1, 'b', 'c', 'c', 'c', 'c']
        >>> (keys, groupxs) = ut.group_indices(groupid_list)
        >>> result = ut.repr3((keys, groupxs), nobraces=1, nl=1)
        >>> print(result)
        [1, 'b', 'c'],
        [[1, 3, 5], [0, 2, 4, 6], [7, 8, 9, 10]],
    """
    item_list = range(len(groupid_list))
    grouped_dict = util_dict.group_items(item_list, groupid_list)
    # Sort by groupid for cache efficiency
    keys_ = list(grouped_dict.keys())
    try:
        keys = sorted(keys_)
    except TypeError:
        # Python 3 does not allow sorting mixed types
        keys = util_list.sortedby2(keys_, keys_)
    groupxs = util_dict.dict_take(grouped_dict, keys)
    return keys, groupxs