code: func applyValueTraits(val string, traits map[string][]string) ([]string, error) {
  	// Extract the variablePrefix and variableName from the role variable.
  	variablePrefix, variableName, err := parse.IsRoleVariable(val)
  
  	if err != nil {
  		if !trace.IsNotFound(err) {
  			return nil, trace.Wrap(err)
  		}
  		return []string{val}, nil
  	}
  
  	// For internal traits, only internal.logins and internal.kubernetes_groups is supported at the moment.
  	if variablePrefix == teleport.TraitInternalPrefix {
  		if variableName != teleport.TraitLogins && variableName != teleport.TraitKubeGroups {
  			return nil, trace.BadParameter("unsupported variable %q", variableName)
  		}
  	}
  
  	// If the variable is not found in the traits, skip it.
  	variableValues, ok := traits[variableName]
  	if !ok || len(variableValues) == 0 {
  		return nil, trace.NotFound("variable %q not found in traits", variableName)
  	}
  
  	return append([]string{}, variableValues...), nil
  }
docs: // applyValueTraits applies the passed in traits to the variable,
  // returns BadParameter in case if referenced variable is unsupported,
  // returns NotFound in case if referenced trait is missing,
  // mapped list of values otherwise, the function guarantees to return
  // at least one value in case if return value is nil