'Add filter to query.
Args:
property_operator: string with the property and operator to filter by.
value: the filter value.
Returns:
Self to support method chaining.
Raises:
PropertyError if invalid property is provided.'

def filter(self, property_operator, value):

    match = _FILTER_REGEX.match(property_operator)
    prop = match.group(1)
    if (match.group(3) is not None):
        operator = match.group(3)
    else:
        operator = '=='
    if (self._model_class is None):
        if (prop != datastore_types.KEY_SPECIAL_PROPERTY):
            raise BadQueryError(('Only    %s    filters    are    allowed    on    kindless    queries.' % datastore_types.KEY_SPECIAL_PROPERTY))
    elif (prop in self._model_class._unindexed_properties):
        raise PropertyError(("Property    '%s'    is    not    indexed" % prop))
    if (operator.lower() == 'in'):
        if self._keys_only:
            raise BadQueryError('Keys    only    queries    do    not    support    IN    filters.')
        elif (not isinstance(value, (list, tuple))):
            raise BadValueError('Argument    to    the    "in"    operator    must    be    a    list')
        values = [_normalize_query_parameter(v) for v in value]
        self.__filter_disjunction((prop + '    ='), values)
    else:
        if isinstance(value, (list, tuple)):
            raise BadValueError('Filtering    on    lists    is    not    supported')
        if (operator == '!='):
            if self._keys_only:
                raise BadQueryError('Keys    only    queries    do    not    support    !=    filters.')
            self.__filter_disjunction([(prop + '    <'), (prop + '    >')], _normalize_query_parameter(value))
        else:
            value = _normalize_query_parameter(value)
            for query_set in self.__query_sets:
                datastore._AddOrAppend(query_set, property_operator, value)
    return self
