import itertools


def _group_multiplexed(sample_list):
    """Group samples sharing the same reads file."""
    grouped = itertools.groupby(sample_list, key=lambda x: x.path)
    return {key: list(group) for key, group in grouped}