code: def to_dict(self):
          
          if self.view == TREE_VIEW:
              result = dict(self._get_view_results(view=TEXT_VIEW))
          else:
              result = dict(self)
          return result
docs: Dump dictionary of the text view. It does not matter which view you are currently in. It will give you the dictionary of the text view.