I don't think there is. The TreeWidget is not exposed into Python (AFAIK).
The whole feature relies on a new parameter Preferences->View->TreeViewDocument which takes an integer value 0/1/2 corresponding to the 3 different modes. I used an integer so it can be extended if somebody comes up with another mode. Anyhow, once the value is set there needs to be a trigger, the simplest way is calling App::setActiveDocument - although the Python version might check if there is a change and shortcut the logic if you're setting the same document (Gui::setActiveDocument does that for sure).