code: func GetDataRateIndex(uplink bool, v DataRateGetter, b band.Band) (int, error) {
  	var dr band.DataRate
  
  	switch v.GetModulation() {
  	case common.Modulation_LORA:
  		modInfo := v.GetLoraModulationInfo()
  		if modInfo == nil {
  			return 0, errors.New("lora_modulation_info must not be nil")
  		}
  		dr.Modulation = band.LoRaModulation
  		dr.SpreadFactor = int(modInfo.SpreadingFactor)
  		dr.Bandwidth = int(modInfo.Bandwidth)
  	case common.Modulation_FSK:
  		modInfo := v.GetFskModulationInfo()
  		if modInfo == nil {
  			return 0, errors.New("fsk_modulation_info must not be nil")
  		}
  		dr.Modulation = band.FSKModulation
  		dr.Bandwidth = int(modInfo.Bandwidth)
  		dr.BitRate = int(modInfo.Bitrate)
  	default:
  		return 0, fmt.Errorf("unknown modulation: %s", v.GetModulation())
  	}
  
  	return b.GetDataRateIndex(uplink, dr)
  }
docs: // GetDataRateIndex returns the data-rate index.