'Constructor.
Raises BadArgumentError if kind is not a string. Raises BadValueError or
BadFilterError if filters is not a dictionary of valid filters.
Args:
namespace: string, the namespace to query.
kind: string, the kind of entities to query, or None.
filters: dict, initial set of filters.
keys_only: boolean, if keys should be returned instead of entities.
projection: iterable of property names to project.
distinct: boolean, if projection should be distinct.
compile: boolean, if the query should generate cursors.
cursor: datastore_query.Cursor, the start cursor to use.
end_cursor: datastore_query.Cursor, the end cursor to use.
_namespace: deprecated, use namespace instead.'

def __init__(self, kind=None, filters={}, _app=None, keys_only=False, compile=True, cursor=None, namespace=None, end_cursor=None, projection=None, distinct=None, _namespace=None):

    if (namespace is None):
        namespace = _namespace
    elif (_namespace is not None):
        raise datastore_errors.BadArgumentError('Must    not    set    both    _namespace    and    namespace    parameters.')
    if (kind is not None):
        datastore_types.ValidateString(kind, 'kind', datastore_errors.BadArgumentError)
    self.__kind = kind
    self.__orderings = []
    self.__filter_order = {}
    self.update(filters)
    self.__app = datastore_types.ResolveAppId(_app)
    self.__namespace = datastore_types.ResolveNamespace(namespace)
    self.__query_options = datastore_query.QueryOptions(keys_only=keys_only, produce_cursors=compile, start_cursor=cursor, end_cursor=end_cursor, projection=projection)
    if distinct:
        if (not self.__query_options.projection):
            raise datastore_errors.BadQueryError('cannot    specify    distinct    without    a    projection')
        self.__distinct = True
        self.__group_by = self.__query_options.projection
