def _iter_groups(grouped):
    """
    Iterates through a flattened sequence
    :param grouped:
    :return:
    """
    for k, value_or_list in grouped.items():
        try:
            for list_item in value_or_list:
                yield k, list_item
        except TypeError:
            yield k, value_or_list
