Flattens keys / values in a heirarchical dictionary

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_dict import *  # NOQA
        >>> import utool as ut
        >>> item_list     = [1, 2, 3, 4]
        >>> groupids_list = [[1, 1, 1, 2], [1, 2, 2, 2], [1, 3, 1, 1]]
        >>> dict_ = hierarchical_group_items(item_list, groupids_list)
        >>> flatter_dict = flatten_dict_items(dict_)
        >>> result = ('flatter_dict = ' + ut.repr4(flatter_dict, nl=1))
        >>> print(result)
        flatter_dict = {
            (1, 1, 1): [1],
            (1, 2, 1): [3],
            (1, 2, 3): [2],
            (2, 2, 1): [4],
        }

def flatten_dict_items(dict_):
    """
    Flattens keys / values in a heirarchical dictionary

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_dict import *  # NOQA
        >>> import utool as ut
        >>> item_list     = [1, 2, 3, 4]
        >>> groupids_list = [[1, 1, 1, 2], [1, 2, 2, 2], [1, 3, 1, 1]]
        >>> dict_ = hierarchical_group_items(item_list, groupids_list)
        >>> flatter_dict = flatten_dict_items(dict_)
        >>> result = ('flatter_dict = ' + ut.repr4(flatter_dict, nl=1))
        >>> print(result)
        flatter_dict = {
            (1, 1, 1): [1],
            (1, 2, 1): [3],
            (1, 2, 3): [2],
            (2, 2, 1): [4],
        }
    """
    import utool as ut
    flat_dict = ut.flatten_dict_vals(dict_)
    flatter_dict = dict([(tuple(ut.unpack_iterables(key)[:-1]), val)
                         for key, val in flat_dict.items()])
    return flatter_dict