code: func (k *KeyManager) handleKeyRequest(key, query string, opts *KeyRequestOptions) (*KeyResponse, error) {
  	resp := &KeyResponse{
  		Messages: make(map[string]string),
  		Keys:     make(map[string]int),
  	}
  	qName := internalQueryName(query)
  
  	// Decode the new key into raw bytes
  	rawKey, err := base64.StdEncoding.DecodeString(key)
  	if err != nil {
  		return resp, err
  	}
  
  	// Encode the query request
  	req, err := encodeMessage(messageKeyRequestType, keyRequest{Key: rawKey})
  	if err != nil {
  		return resp, err
  	}
  
  	qParam := k.serf.DefaultQueryParams()
  	if opts != nil {
  		qParam.RelayFactor = opts.RelayFactor
  	}
  	queryResp, err := k.serf.Query(qName, req, qParam)
  	if err != nil {
  		return resp, err
  	}
  
  	// Handle the response stream and populate the KeyResponse
  	resp.NumNodes = k.serf.memberlist.NumMembers()
  	k.streamKeyResp(resp, queryResp.respCh)
  
  	// Check the response for any reported failure conditions
  	if resp.NumErr != 0 {
  		return resp, fmt.Errorf("%d/%d nodes reported failure", resp.NumErr, resp.NumNodes)
  	}
  	if resp.NumResp != resp.NumNodes {
  		return resp, fmt.Errorf("%d/%d nodes reported success", resp.NumResp, resp.NumNodes)
  	}
  
  	return resp, nil
  }
docs: // handleKeyRequest performs query broadcasting to all members for any type of
  // key operation and manages gathering responses and packing them up into a
  // KeyResponse for uniform response handling.