Building a tree "backwards"
<p>I need to create a tree-like structure in Python. I have a function get(parentId), which returns a list of objects with that parent -- I think that should be done recursively.</p>

<p>The result should be something like this: <code>["root object", ["child1 of root", "child2 of root", ["child2-1", "child2-2"]]]</code></p>

<p>Every object has a attribute parent, which is is the parentId for get(), but as a starting point I only have the root object.</p>
