def group_patients(patients):
    """Group patients by their label."""
    n_labels = len({p.label for p in patients})
    groups = [[p for p in patients if p.label == i] for i in range(n_labels)]
    return groups