'Filter data based on filters. All the filters must match for an item to
be accepted. Matching is case independent regexp matching.
@param filters: A list of SearchToken objects
@param refilter: If True filters are applied to the results of the previous
filtering.
@param OR: If True, keeps a match if any one of the filters matches. If False,
keeps a match only if all the filters match'

def filter(self, filters, refilter=False, OR=False):

    if (not filters):
        self.data = (self.data if refilter else self.cache)
    else:
        matches = []
        for item in (self.data if refilter else self.cache):
            if OR:
                keep = False
                for token in filters:
                    if token.match(item):
                        keep = True
                        break
                if keep:
                    matches.append(item)
            else:
                keep = True
                for token in filters:
                    if (not token.match(item)):
                        keep = False
                        break
                if keep:
                    matches.append(item)
        self.data = matches
