code: func (c *RegionCache) GroupKeysByRegion(bo *Backoffer, keys [][]byte) (map[RegionVerID][][]byte, RegionVerID, error) {
  	groups := make(map[RegionVerID][][]byte)
  	var first RegionVerID
  	var lastLoc *KeyLocation
  	for i, k := range keys {
  		if lastLoc == nil || !lastLoc.Contains(k) {
  			var err error
  			lastLoc, err = c.LocateKey(bo, k)
  			if err != nil {
  				return nil, first, errors.Trace(err)
  			}
  		}
  		id := lastLoc.Region
  		if i == 0 {
  			first = id
  		}
  		groups[id] = append(groups[id], k)
  	}
  	return groups, first, nil
  }
docs: // GroupKeysByRegion separates keys into groups by their belonging Regions.
  // Specially it also returns the first key's region which may be used as the
  // 'PrimaryLockKey' and should be committed ahead of others.