code: func (d *TimePeriod_Duration) ToSeconds() (int64, error) {
  	// Decompose the duration into a slice of [duration, <int64>, <unit>].
  	m := regexp.MustCompile(durationRegex).FindStringSubmatch(d.Duration)
  	if len(m) != 3 {
  		return 0, errors.Reason("duration must match regex %q", durationRegex).Err()
  	}
  	n, err := strconv.ParseInt(m[1], 10, 64)
  	if err != nil {
  		return 0, errors.Reason("duration must not exceed %q", int64(math.MaxInt64)).Err()
  	}
  	var mul int64
  	switch m[2] {
  	case "s":
  		// 1 second.
  		mul = 1
  	case "m":
  		// 60 seconds.
  		mul = 60
  	case "h":
  		// 60 minutes.
  		mul = 3600
  	case "d":
  		// 24 hours.
  		mul = 86400
  	case "mo":
  		// 30 days.
  		mul = 2592000
  	}
  	if n > math.MaxInt64/mul {
  		n = math.MaxInt64
  	} else {
  		n *= mul
  	}
  	return n, nil
  }
docs: // ToSeconds returns this duration in seconds. Clamps to math.MaxInt64.