'Returns a dictionary mapping the given device key to (number of
partitions assigned to that key).'

def _partition_counts(self, builder, key='id'):

    return Counter((builder.devs[dev_id][key] for part2dev_id in builder._replica2part2dev for dev_id in part2dev_id))
