Curve from line

Hello I tried this python script as I want to convert a list of lines and sublists into a curve list, but this works only with flatten list of lines. I think it is easy solution if you have an answer would be great. Thanks.

Although I tried to offset curve with no offset, as the python code, it sounds silly solution, but is this an appropriate way to get the list of lines transformed into curves list?
image