@classmethod
    def _current_group_alternate(cls, group, conf=None):
        alternates_count = int(config.get_config("HM_ALTERNATIVE_CONFIG_COUNT", 1, conf))
        hosts = model.storage(conf).list_hosts({'group': group})
        alterantives_map = collections.defaultdict(int)
        for host in hosts:
            alterantives_map[host.alternative_id] += 1
        min_alt_id = 0
        min_alt_count = None
        for i in xrange(alternates_count):
            if min_alt_count is None or alterantives_map[i] < min_alt_count:
                min_alt_id = i
                min_alt_count = alterantives_map[i]
        return min_alt_id
dataset/ETHPy150Open tsuru/hm/hm/model/host.py/Host._current_group_alternate/original