def _prune_bifixes(set_of_words):
    """
    Remove words from a set that are proper prefixes or suffixes of another word

    Example
    -------
    >>> set_of_words = {'aba', 'a', 'aaba'}
    >>> _prune_bifixes(set_of_words)
    {'aaba'}
    """
    cleaned = set()
    bad_words = set()
    for elem1 in set_of_words:
        for elem2 in set_of_words:
            if elem1 == elem2:
                continue
            if elem2.startswith(elem1) or elem2.endswith(elem1):
                bad_words.add(elem1)
    cleaned = set.difference(set_of_words, bad_words)
    return cleaned