def METHOD_NAME (balances, limit):
    """
    Function to selecting the commands_on_host ids to re-schedule.
    First step is the choice of treshold into the sorted dict (by balance).
    This treshold is considered as the lower limit of the interval to drawing
    next ids to select.
    All the choices are based on random selecting.
    @param balances: dictionary of balances having CoH id as key
    @type balances: dict
    @param limit: maximum of selected commands
    @type limit: int
    @return: list of CoH ids to reschedule
    @rtype: list
    """
    if len(balances) > 0 :
        if len(balances) <= limit :
            # no necesity to choice the most important CoHs
            return balances.keys()
        while True :
            # sort by balance
            sorted_keys = sorted(balances, key=balances.get, reverse=True)
            # draw the treshold
            drw_coh = random.choice(sorted_keys)
            logging.getLogger().debug("Keys to draw: %s " % str(sorted_keys))
            treshold_idx = sorted_keys.index(drw_coh)
            # remove all the keys bellow the treshold
            sorted_keys = sorted_keys[-treshold_idx:]
            logging.getLogger().debug("Reduced interval: %s " % str(sorted_keys))
            count = 0
            selected = []
            while True :
                if count >= limit :
                    break
                if count >= len(sorted_keys) :
                    break
                drw_coh = random.choice(sorted_keys)
                if drw_coh not in selected :
                    selected.append(drw_coh)
                    count += 1
            if len(selected) / limit > 0.8 :
                # OK when number of selected is more than 80% of limit
                return selected
            else :
                logging.getLogger().debug("List of drawed CoHs too small. Repeat the drawing")