'Constructor.
Args:
op: The operator to use to combine the given filters
filters: A list of one or more filters to combine
Raises:
datastore_errors.BadArgumentError if op is not in CompsiteFilter.OPERATORS
or filters is not a non-empty list containing only FilterPredicates.'

def __init__(self, op, filters):

    if (not (op in self._OPERATORS)):
        raise datastore_errors.BadArgumentError(('unknown    operator    (%s)' % (op,)))
    if ((not filters) or (not isinstance(filters, (list, tuple)))):
        raise datastore_errors.BadArgumentError(('filters    argument    should    be    a    non-empty    list    (%r)' % (filters,)))
    super(CompositeFilter, self).__init__()
    self._op = op
    flattened = []
    for f in filters:
        if (isinstance(f, CompositeFilter) and (f._op == self._op)):
            flattened.extend(f._filters)
        elif isinstance(f, FilterPredicate):
            flattened.append(f)
        else:
            raise datastore_errors.BadArgumentError(('filters    argument    must    be    a    list    of    FilterPredicates,    found    (%r)' % (f,)))
    if (op == self.AND):
        filters = flattened
        flattened = []
        ineq_map = {}
        for f in filters:
            if (isinstance(f, _PropertyRangeFilter) or (isinstance(f, PropertyFilter) and f._has_inequality())):
                name = f._get_prop_name()
                index = ineq_map.get(name)
                if (index is not None):
                    range_filter = flattened[index]
                    flattened[index] = range_filter.intersect(f)
                else:
                    if isinstance(f, PropertyFilter):
                        range_filter = _PropertyRangeFilter.from_property_filter(f)
                    else:
                        range_filter = f
                    ineq_map[name] = len(flattened)
                    flattened.append(range_filter)
            else:
                flattened.append(f)
    self._filters = tuple(flattened)
