Group splines by height using animation nodes
Finally a script did the job.
splines = [&quot;S1&quot;, &quot;S2&quot;, &quot;S3&quot;, &quot;S4&quot;, &quot;S5&quot;, &quot;S6&quot;, &quot;S7&quot;, &quot;S8&quot;, &quot;S9&quot;, &quot;S10&quot;]
heights = [3, 7, 3, 15, 15, 7,]
uniques_heights = list({ h for h in heights})
print(sorted(uniques_heights))
splines_per_heights = []
for h in sorted(uniques_heights):
    spline_h = []
    for i in range(len(heights)):
        if heights[i] == h:
            spline_h.append(splines[i])
    splines_per_heights.append(spline_h)
print(splines_per_heights)

The script basically takes two lists, one filled with splines and one with the heights for each spline. First creates a dictionary representing each unique height. Then identifies all splines sharing same height and appends them into a list resulting in a list of splines for each height, and lastly it creates a final list including all the lists per height.
Here the result once inside the nodetree.