'Searches names that are defined in a scope (the different
``filters``), until a name fits.'

def filter_name(self, filters):

    names = []
    if self._context.predefined_names:
        node = self._name
        while ((node is not None) and (not node.is_scope())):
            node = node.parent
            if (node.type in ('if_stmt', 'for_stmt', 'comp_for')):
                try:
                    name_dict = self._context.predefined_names[node]
                    types = name_dict[self._string_name]
                except KeyError:
                    continue
                else:
                    self._found_predefined_types = types
                    break
    for filter in filters:
        names = filter.get(self._string_name)
        if names:
            break
    debug.dbg('finder.filter_name    "%s"    in    (%s):    %s@%s', self._string_name, self._context, names, self._position)
    return list(names)
