prev = None
curr = None
for i in range(len(old_d[sort_key])):
    curr = old_d[sort_key][i]
for key, lst in new_d.items():
    if prev == curr:
        if key != sort_key:
            lst[-1] += old_d[key][i]
else:
    lst.append(old_d[key][i])
prev = curr
return new_d
How to sum 3 same sized sorted lists based on the identical elements of the first one in Python?