code: func (m TagMap) toProperties() (ds.PropertySlice, error) {
  	if len(m) == 0 {
  		return nil, nil
  	}
  
  	// Deterministic conversion.
  	keys := make([]string, 0, len(m))
  	for k := range m {
  		keys = append(keys, k)
  	}
  	sort.Strings(keys)
  
  	parts := make(ds.PropertySlice, 0, len(m)*2)
  	for _, k := range keys {
  		v := m[k]
  		if err := types.ValidateTag(k, v); err != nil {
  			return nil, err
  		}
  
  		// Presence entry.
  		parts = append(parts, ds.MkProperty(encodeKey(k)))
  
  		// Value entry.
  		parts = append(parts, ds.MkProperty(encodeKey(fmt.Sprintf("%s=%s", k, v))))
  	}
  	return parts, nil
  }
docs: // toProperties converts a TagMap to a set of Property objects for storage.