code: func changesByZone(zones map[string]*route53.HostedZone, changeSet []*route53.Change) map[string][]*route53.Change {
  	changes := make(map[string][]*route53.Change)
  
  	for _, z := range zones {
  		changes[aws.StringValue(z.Id)] = []*route53.Change{}
  	}
  
  	for _, c := range changeSet {
  		hostname := ensureTrailingDot(aws.StringValue(c.ResourceRecordSet.Name))
  
  		zones := suitableZones(hostname, zones)
  		if len(zones) == 0 {
  			log.Debugf("Skipping record %s because no hosted zone matching record DNS Name was detected ", c.String())
  			continue
  		}
  		for _, z := range zones {
  			changes[aws.StringValue(z.Id)] = append(changes[aws.StringValue(z.Id)], c)
  			log.Debugf("Adding %s to zone %s [Id: %s]", hostname, aws.StringValue(z.Name), aws.StringValue(z.Id))
  		}
  	}
  
  	// separating a change could lead to empty sub changes, remove them here.
  	for zone, change := range changes {
  		if len(change) == 0 {
  			delete(changes, zone)
  		}
  	}
  
  	return changes
  }
docs: // changesByZone separates a multi-zone change into a single change per zone.