from typing import OrderedDict


def get_top_unique_tags(tags_assigned, k=None):
    """
    given a list with potential duplicates, return the top K unique
    tags in the list.

    Sample input:
        ['foo','bar','foo','bar','baz','quux']
    Sample output (for k=2):
        ['foo','bar']

    :param tags_assigned:
    :param k: number of unique tags to keep
    :return: top unique tags
    """
    if k is None:
        k = 25

    count_dict = OrderedDict()

    for tag in tags_assigned:

        if count_dict.get(tag) is None:
            count_dict[tag] = 1
        else:
            count_dict[tag] = count_dict[tag] + 1

    sorted_items = sorted(count_dict.items(), key=lambda x: x[1], reverse=True)

    top_sorted = sorted_items[:k]

    return [x[0] for x in top_sorted]