Using tree helpers to convert a simple linear list into a simple tree?

I have a simple linear list, and in a Python module I’d like to convert it to a simple tree, like this:

[0,1,2,3] → {0;1} = 0, {0;2} = 1, {0;2} = 2, etc.

So effectively a graft of the list.

It seems no matter what I try, the python output is always just a list. Of course I can graft the output explicitly, but I’d like to do it in the code if possible.

Thanks for any insight.