def _collection_indexes_iocc(iocc, nvirt, spin=None):
    """
    For each iocc and a selected spin provide the list of couples that are
    concerned up to nvirt
    If spin is none provide the list for all values of the spin
    """
    harvest = []
    for ispin in [0, 1]:
        jspin = ispin if len(nvirt) == 2 else 0
        if spin is not None and ispin != spin:
            continue
        for ialpha in range(nvirt[jspin]):
            harvest.append([iocc, ialpha, ispin])
    return harvest