code: func dividePartitionsBetweenConsumers(consumers kazoo.ConsumergroupInstanceList, partitions partitionLeaders) map[string][]*kazoo.Partition {
  	result := make(map[string][]*kazoo.Partition)
  
  	plen := len(partitions)
  	clen := len(consumers)
  	if clen == 0 {
  		return result
  	}
  
  	sort.Sort(partitions)
  	sort.Sort(consumers)
  
  	n := plen / clen
  	m := plen % clen
  	p := 0
  	for i, consumer := range consumers {
  		first := p
  		last := first + n
  		if m > 0 && i < m {
  			last++
  		}
  		if last > plen {
  			last = plen
  		}
  
  		for _, pl := range partitions[first:last] {
  			result[consumer.ID] = append(result[consumer.ID], pl.partition)
  		}
  		p = last
  	}
  
  	return result
  }
docs: // Divides a set of partitions between a set of consumers.