Retreive and Set layer's expand/collapse state via scripting

Hi,

I think that it would be cool if there was a possibility to retreive and set a layer’s expand/collapse state via scripting.

Related topic:
https://forums.toonboom.com/t/another-center-on-selection-keyboard-shortcut-that-doesnt-change-child-items-expand-collapse-states/18407