code: func NormalizeMetricFamilies(metricFamiliesByName map[string]*dto.MetricFamily) []*dto.MetricFamily {
  	for _, mf := range metricFamiliesByName {
  		sort.Sort(metricSorter(mf.Metric))
  	}
  	names := make([]string, 0, len(metricFamiliesByName))
  	for name, mf := range metricFamiliesByName {
  		if len(mf.Metric) > 0 {
  			names = append(names, name)
  		}
  	}
  	sort.Strings(names)
  	result := make([]*dto.MetricFamily, 0, len(names))
  	for _, name := range names {
  		result = append(result, metricFamiliesByName[name])
  	}
  	return result
  }
docs: // NormalizeMetricFamilies returns a MetricFamily slice with empty
  // MetricFamilies pruned and the remaining MetricFamilies sorted by name within
  // the slice, with the contained Metrics sorted within each MetricFamily.