def losocv_split(subjectIDs):
    """Create leave-one-subject-out cross-validation train/test splits.

    Args:
        subjectIDs (list): subjectID corresponding to each example.

    Returns:
        splits (list of lists): each fold's train and test indices.
        subjectIDset (list): unique IDs, in held-out-test-set order

    """

    subjectIDset = list(set(subjectIDs))
    splits = []
    for subject in subjectIDset:
        test_idx = [i for i in range(len(subjectIDs)) if subjectIDs[i]==subject]
        train_idx = [i for i in range(len(subjectIDs)) if subjectIDs[i]!=subject]
        
        splits.append([train_idx,test_idx])

    return splits, subjectIDset