code: func WriteYAML(w io.Writer, values interface{}) error {
  	if reflect.TypeOf(values).Kind() != reflect.Slice {
  		return trace.Wrap(writeYAML(w, values))
  	}
  	// first pass makes sure that all values are documents (objects or maps)
  	slice := reflect.ValueOf(values)
  	allDocs := func() bool {
  		for i := 0; i < slice.Len(); i++ {
  			if !isDoc(slice.Index(i)) {
  				return false
  			}
  		}
  		return true
  	}
  	if !allDocs() {
  		return trace.Wrap(writeYAML(w, values))
  	}
  	// second pass can marshal documents
  	for i := 0; i < slice.Len(); i++ {
  		err := writeYAML(w, slice.Index(i).Interface())
  		if err != nil {
  			return trace.Wrap(err)
  		}
  		if i != slice.Len()-1 {
  			if _, err := w.Write([]byte(yamlDocDelimiter + "\n")); err != nil {
  				return trace.Wrap(err)
  			}
  		}
  	}
  	return nil
  }
docs: // WriteYAML detects whether value is a list
  // and marshals multiple documents delimited by `---`, otherwise, marshals
  // a single value