Was looking for a recent solution to this and I downloaded your python and attempted to publish and it simply crashes in Catalog when trying to publish. I have tried looking into the Export Item as well with no luck on how to set that up either. If you can provide some insight into setting this up that would be greatly appreciated. If not I'll start a new question. Thank you.
That was my mistake. I sent the wrong script. I've attached the correct one.