'Adds WHERE arguments to the queryset, returning a new queryset
See :ref:`retrieving-objects-with-filters`
Returns a QuerySet filtered on the keyword arguments'

def filter(self, *args, **kwargs):

    if len([x for x in kwargs.values() if (x is None)]):
        raise CQLEngineException('None    values    on    filter    are    not    allowed')
    clone = copy.deepcopy(self)
    for operator in args:
        if (not isinstance(operator, WhereClause)):
            raise QueryException('{0}    is    not    a    valid    query    operator'.format(operator))
        clone._where.append(operator)
    for (arg, val) in kwargs.items():
        (col_name, col_op) = self._parse_filter_arg(arg)
        quote_field = True
        if (not isinstance(val, Token)):
            try:
                column = self.model._get_column(col_name)
            except KeyError:
                raise QueryException("Can't    resolve    column    name:    '{0}'".format(col_name))
        else:
            if (col_name != 'pk__token'):
                raise QueryException("Token()    values    may    only    be    compared    to    the    'pk__token'    virtual    column")
            column = columns._PartitionKeysToken(self.model)
            quote_field = False
            partition_columns = column.partition_columns
            if (len(partition_columns) != len(val.value)):
                raise QueryException('Token()    received    {0}    arguments    but    model    has    {1}    partition    keys'.format(len(val.value), len(partition_columns)))
            val.set_columns(partition_columns)
        operator_class = BaseWhereOperator.get_operator((col_op or 'EQ'))
        operator = operator_class()
        if isinstance(operator, InOperator):
            if (not isinstance(val, (list, tuple))):
                raise QueryException('IN    queries    must    use    a    list/tuple    value')
            query_val = [column.to_database(v) for v in val]
        elif isinstance(val, BaseQueryFunction):
            query_val = val
        elif (isinstance(operator, ContainsOperator) and isinstance(column, (columns.List, columns.Set, columns.Map))):
            query_val = val
        else:
            query_val = column.to_database(val)
            if (not col_op):
                clone._defer_fields.add(column.db_field_name)
                clone._deferred_values[column.db_field_name] = val
        clone._where.append(WhereClause(column.db_field_name, operator, query_val, quote_field=quote_field))
    return clone
