code: def get_message(self, set_slave_ok, sock_info, use_cmd=False):
          
          if set_slave_ok:
              # Set the slaveOk bit.
              flags = self.flags | 4
          else:
              flags = self.flags
  
          ns = self.namespace()
          spec = self.spec
  
          if use_cmd:
              spec = self.as_command(sock_info)[0]
              if sock_info.op_msg_enabled:
                  request_id, msg, size, _ = _op_msg(
                      0, spec, self.db, self.read_preference,
                      set_slave_ok, False, self.codec_options,
                      ctx=sock_info.compression_context)
                  return request_id, msg, size
              ns = _UJOIN % (self.db, "$cmd")
              ntoreturn = -1  # All DB commands return 1 document
          else:
              # OP_QUERY treats ntoreturn of -1 and 1 the same, return
              # one document and close the cursor. We have to use 2 for
              # batch size if 1 is specified.
              ntoreturn = self.batch_size == 1 and 2 or self.batch_size
              if self.limit:
                  if ntoreturn:
                      ntoreturn = min(self.limit, ntoreturn)
                  else:
                      ntoreturn = self.limit
  
          if sock_info.is_mongos:
              spec = _maybe_add_read_preference(spec,
                                                self.read_preference)
  
          return query(flags, ns, self.ntoskip, ntoreturn,
                       spec, None if use_cmd else self.fields,
                       self.codec_options, ctx=sock_info.compression_context)
docs: Get a query message, possibly setting the slaveOk bit.