def sort_datasplit(split):
    """Sorts a single split of the SidechainNet data dict by ascending length."""
    sorted_len_indices = [
        a[0]
        for a in sorted(enumerate(split['seq']), key=lambda x: len(x[1]), reverse=False)
    ]

    for datatype in split.keys():
        split[datatype] = [split[datatype][i] for i in sorted_len_indices]

    return split