'Returns an internal pb representation.'

def _to_pb(self):

    pb = datastore_pb.Query()
    pb.set_app(self.__app)
    datastore_types.SetNamespace(pb, self.__namespace)
    if (self.__kind is not None):
        pb.set_kind(self.__kind)
    if self.__ancestor:
        ancestor = pb.mutable_ancestor()
        ancestor.CopyFrom(self.__ancestor)
    return pb
