import string


def filter_term(term, vocabulary):
    """If a word is not present in a vocabulary, check whether its lowercased or capitalized versions are present.
    If not and word is not a punctuation sign, then it is OOV. Otherwise, it is replaced by different case.
    Punctuation signs are omitted completely.

    Args:
        term (string): a word to check/
        vocabulary (dictionary): a vocabulary in a format {token: index}.
    Returns:
         (string): a version of the word that is in the vocabulary OR an empty string (punctuation) OR OOV tag.
    """
    if term in vocabulary.keys():
        return term
    else:
        if term.lower() in vocabulary.keys():
            return term.lower()
        elif term.capitalize() in vocabulary.keys():
            return term.capitalize()
        elif term.lower().capitalize() in vocabulary.keys():
            return term.lower().capitalize()
        else:
            if term in string.punctuation:
                return ''
            else:
                return 'OOV'