def filter_index(self, name, filters, dict_key=None):
    intersect = self.get_index(name, *filters.keys())
    is_callable = {}
    is_regex = {}
    for key in filters:
        value = filters[key]
        is_callable[key] = (isinstance(value, FunctionType) or isinstance(value, LambdaType))
        is_regex[key] = isinstance(value, _pattern_type)
    if dict_key:
        output = {}
    else:
        output = []
    for idx in intersect:
        row = self.table.row(idx)
        available = True
        for (key, value) in filters.items():
            if value:
                if is_callable[key]:
                    available = value(idx, row)
                elif is_regex[key]:
                    available = bool(value.match(row[key]))
                else:
                    available = (row[key] == value)
                if (not available):
                    break
            else:
                available = False
                break
        if available:
            if dict_key:
                if (row[dict_key] not in output):
                    output[row[dict_key]] = []
                output[row[dict_key]].append(idx)
            else:
                output.append(idx)
    return output
def filter_index(self, name, filters, dict_key=None):
    intersect = self.get_index(name, *filters.keys())
    is_callable = {}
    is_regex = {}
    for key in filters:
        value = filters[key]
        is_callable[key] = (isinstance(value, FunctionType) or isinstance(value, LambdaType))
        is_regex[key] = isinstance(value, _pattern_type)
    if dict_key:
        output = {}
    else:
        output = []
    for idx in intersect:
        row = self.table.row(idx)
        available = True
        for (key, value) in filters.items():
            if value:
                if is_callable[key]:
                    available = value(idx, row)
                elif is_regex[key]:
                    available = bool(value.match(row[key]))
                else:
                    available = (row[key] == value)
                if (not available):
                    break
            else:
                available = False
                break
        if available:
            if dict_key:
                if (row[dict_key] not in output):
                    output[row[dict_key]] = []
                output[row[dict_key]].append(idx)
            else:
                output.append(idx)
    return output