docs: def _restore_expansion_state(self):
          """Iter recursively all tree items and restore expansion state"""
  
          def restore_tree_expansion(child_tree_iter, expansion_state):
              tree_item_path = self.history_tree_store.get_path(child_tree_iter)
              history_item = self.get_history_item_for_tree_iter(child_tree_iter)
  
              # restore expansion state if tree item path is valid and expansion state was not stored already
              if tree_item_path and history_item in expansion_state:
                  if expansion_state[history_item]:
                      self.history_tree.expand_to_path(tree_item_path)
  
              for n in range(self.history_tree_store.iter_n_children(child_tree_iter)):
                  child_iter = self.history_tree_store.iter_nth_child(child_tree_iter, n)
                  restore_tree_expansion(child_iter, expansion_state)
  
          root_iter = self.history_tree_store.get_iter_first()
          if not root_iter:
              return
          state_machine = self.get_history_item_for_tree_iter(root_iter).state_reference.get_state_machine()
          if state_machine.state_machine_id not in self._expansion_state:
              return
          while root_iter:
              restore_tree_expansion(root_iter, self._expansion_state[state_machine.state_machine_id])
              root_iter = self.history_tree_store.iter_next(root_iter)