this is cool to me:
# a stack to perform a depth-first enumeration of the tree
# index stream offset index offset region size
indices = [(self.tail, 0, 0, total_size)]I didn't realise i was traversing the tree in a depth-first manner until I wrote the comment. Studying depth-first traversal implementations would likely simplify this problem for me.
