from typing import List


def flatten_dict_to_pairs(labeled_data) -> List[list]:
    """
    Takes as input a dict of key -> list and turns it into a single unified list of pairs
    of entry and label.  Thus
    { 'a': ['frodo', 'sam'], 'b': ['merry', 'pippin' ] }
    becomes
    [ ['frodo', 'a], ['sam', 'a'], ['merry', 'b'], ['pippin', 'b'] ]

    :param labeled_data: The dict of labeled data.
    :return: Combined list of all values with parallel list of all matching labels.
    """
    result = []
    for label, values in labeled_data.items():
        for item in values:
            result.append([item, label])
    return result