[Python] How can I transform a nested list to tree with branches?

This:

L = [[a1,b1],[a1,b1],...,[an,bn]]

image

to this:

with Python?

Never mind, I got it

from ghpythonlib import treehelpers as th

L = [[a1,b1],[a1,b1],...,[an,bn]]
a = th.list_to_tree(L)

@DavidLeon,

I respect you trying to help and answer my question, but being a Moderator or not, leave the original poster to decide what is a solution and what is not.

Thanks.

No problem. Thanks for sharing your solution