import collections


def _select_targets(y, min_threshold=10, max_threshold=None):
    """_select_targets.

    Return the set of targets that are occurring a number of times bounded
    by min_threshold and max_threshold.
    """
    c = collections.Counter(y)
    y_sel = []
    for y_id in c:
        if c[y_id] > min_threshold:
            if max_threshold and c[y_id] < max_threshold:
                y_sel.append(y_id)
            else:
                y_sel.append(y_id)
    return y_sel