code: func GetQueryKey(q *protocol.KontrolQuery) (string, error) {
  	fields := q.Fields()
  
  	if q.Username == "" {
  		return "", errors.New("Empty username field")
  	}
  
  	// Validate query and build key.
  	path := "/"
  
  	empty := false   // encountered with empty field?
  	empytField := "" // for error log
  
  	// http://golang.org/doc/go1.3#map, order is important and we can't rely on
  	// maps because the keys are not ordered :)
  	for _, key := range keyOrder {
  		v := fields[key]
  		if v == "" {
  			empty = true
  			empytField = key
  			continue
  		}
  
  		if empty && v != "" {
  			return "", fmt.Errorf("Invalid query. Query option is not set: %s", empytField)
  		}
  
  		path = path + v + "/"
  	}
  
  	path = strings.TrimSuffix(path, "/")
  
  	return path, nil
  }
docs: // getQueryKey returns the etcd key for the query.