'Filter to completions matching the item Vim said was completed'

def _FilterToMatchingCompletions(self, completions, full_match_only):

    completed = vimsupport.GetVariableValue(u'v:completed_item')
    for completion in completions:
        item = ConvertCompletionDataToVimData(completion)
        match_keys = ([u'word', u'abbr', u'menu', u'info'] if full_match_only else [u'word'])
        def matcher(key):
            return (utils.ToUnicode(completed.get(key, u'')) == utils.ToUnicode(item.get(key, u'')))
        if all([matcher(i) for i in match_keys]):
            (yield completion)
