def check_unique_list_of_words(words, arg_name):
    """Check that words is a list and each element is a str without any duplication"""

    if not isinstance(words, list):
        raise ValueError(arg_name + " needs to be a list of words of type string.")
    words_set = set()
    for word in words:
        if not isinstance(word, str):
            raise ValueError("each word in " + arg_name + " needs to be type str.")
        if word in words_set:
            raise ValueError(arg_name + " contains duplicate word: " + word + ".")
        words_set.add(word)
    return words_set