code: func validateAvatarUpdateLabels(oldLabel string, newLabel string, username string,
  	userMgr *user.Manager, w http.ResponseWriter) (*user.Avatar, bool) {
  	// lets not change reserved labels.
  	if isReservedAvatarLabel(oldLabel) {
  		log.Debug("trying to modify reserved label")
  		writeErrorResponse(w, http.StatusConflict, "changing_protected_label")
  		return nil, true
  	}
  
  	if isReservedAvatarLabel(newLabel) {
  		log.Debug("trying to assign protected label")
  		writeErrorResponse(w, http.StatusConflict, "assign_reserved_label")
  		return nil, true
  	}
  
  	u, err := userMgr.GetByName(username)
  	if handleServerError(w, "getting user from db", err) {
  		return nil, true
  	}
  
  	// make sure the avatar we want to update exists
  	oldAvatar, err := u.GetAvatarByLabel(oldLabel)
  	if err != nil {
  		http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
  		return nil, true
  	}
  
  	// check if we already have this label in case it gets renamed
  	if oldLabel != newLabel {
  		if _, err = u.GetAvatarByLabel(newLabel); err == nil {
  			writeErrorResponse(w, http.StatusConflict, "duplicate_label")
  			return nil, true
  		}
  	}
  
  	return &oldAvatar, false
  }
docs: // validateAvatarUpdateLabels validates old and new avatar labels and returns a
  // pointer to the old avatar object. The secondary response value indicates whether
  // an error has occurred. In this case callers must not write to the ResponseWriter
  // again.