'Returns the internal only pb representation.'

def _to_pb(self, conn, query_options):

    pb = self._key_filter._to_pb()
    if self._filter_predicate:
        for f in self._filter_predicate._to_pbs():
            pb.add_filter().CopyFrom(f)
    if self._order:
        for order in self._order._to_pbs():
            pb.add_order().CopyFrom(order)
    if QueryOptions.keys_only(query_options, conn.config):
        pb.set_keys_only(True)
    projection = QueryOptions.projection(query_options, conn.config)
    self._validate_projection_and_group_by(projection, self._group_by)
    if projection:
        pb.property_name_list().extend(projection)
    if self._group_by:
        pb.group_by_property_name_list().extend(self._group_by)
    if QueryOptions.produce_cursors(query_options, conn.config):
        pb.set_compile(True)
    limit = QueryOptions.limit(query_options, conn.config)
    if (limit is not None):
        pb.set_limit(limit)
    count = QueryOptions.prefetch_size(query_options, conn.config)
    if (count is None):
        count = QueryOptions.batch_size(query_options, conn.config)
    if (count is not None):
        pb.set_count(count)
    if query_options.offset:
        pb.set_offset(query_options.offset)
    if (query_options.start_cursor is not None):
        try:
            pb.mutable_compiled_cursor().ParseFromString(query_options.start_cursor.to_bytes())
        except ProtocolBuffer.ProtocolBufferDecodeError:
            raise datastore_errors.BadValueError('invalid    cursor')
    if (query_options.end_cursor is not None):
        try:
            pb.mutable_end_compiled_cursor().ParseFromString(query_options.end_cursor.to_bytes())
        except ProtocolBuffer.ProtocolBufferDecodeError:
            raise datastore_errors.BadValueError('invalid    cursor')
    if (((query_options.hint == QueryOptions.ORDER_FIRST) and pb.order_size()) or ((query_options.hint == QueryOptions.ANCESTOR_FIRST) and pb.has_ancestor()) or ((query_options.hint == QueryOptions.FILTER_FIRST) and (pb.filter_size() > 0))):
        pb.set_hint(query_options.hint)
    conn._set_request_read_policy(pb, query_options)
    conn._set_request_transaction(pb)
    return pb
