def matchnocase(word, vocab):
    """
    Match a word to a vocabulary while ignoring case
    :param word: Word to try to match
    :param vocab: Valid vocabulary
    :return:
    >>> matchnocase('mary', {'Alice', 'Bob', 'Mary'})
    'Mary'
    """
    lword = word.lower()
    listvocab = list(vocab) # this trick catches dict and set in addition to list
    lvocab = [w.lower() for w in listvocab]
    if lword in lvocab:
        return listvocab[lvocab.index(lword)]
    return None