docs: function normalize(recordTypes, recordTypeName, record, lang, validationSets) {
  
  	// check that we have the record
  	if ((record === null) || ((typeof record) !== 'object'))
  		throw new common.X2UsageError('Record object was not provided.');
  
  	// get the record type descriptor (or throw error if invalid record type)
  	const recordTypeDesc = recordTypes.getRecordTypeDesc(recordTypeName);
  
  	// extract validation sets
  	var sets = new Set(
  		(validationSets ? validationSets.trim() + ',*' : '*').split(/\s*,\s*/));
  
  	// create validation context
  	const ctx = new ValidationContext(
  		recordTypes, recordTypeDesc, new MessageResolver(lang || '*'), sets);
  
  	// run recursive validation/normalization of the record properties
  	normalizeChildren(ctx, recordTypeDesc, null, record, sets);
  
  	// validate/normalize the record as a whole
  	const recordValidators = getValidators(recordTypeDesc, false, sets);
  	if (recordValidators)
  		for (let validator of recordValidators)
  			validator(ctx, record);
  
  	// return the result
  	return ctx.getResult();
  }