Turns the helper tree from a Rhino FBX import back into nested layers in 3ds Max

The problem: A Rhino model imported into 3ds Max loses its layers. Everything ends up buried in a tree of empty helper objects.
The tool: One script rebuilds the layers and removes the helpers.
The result: 86 layers rebuilt and 17,856 objects moved on a real building model, with nothing shifted. 15+ designers use it every week.
The problem
Ever since my team started using the Iray Mapper script regularly, I've been getting requests to fix all sorts of little workflow annoyances. Which is great, because I love ironing out the wrinkles in our process.
We typically receive architectural design models in Rhino, SketchUp, or Revit and then convert them to 3ds Max models so that we can run our lighting studies with Iray+.
Rhino models transfer as FBX files (a 3D exchange format), and on the way Rhino's layers turn into helpers. Helpers are empty placeholder objects that Max uses as parents. Every piece of geometry ends up buried in a tree of them.
Everyone wanted their layers back.
How it works
So, helper2layer. It's a Python script for 3ds Max. It reads the helper tree, rebuilds it as nested layers with the same names, moves each object onto its layer, and deletes the empty helpers. Geometry and materials stay put.

It can hold the scene first, so one click puts everything back. Then it shows a preview before it changes anything.

That's a real building model. 86 helpers, 17,856 objects.
How it's built
I wrote the plan, a long markdown file covering how the script should behave and what it should never touch. Never move an object. Never alter a material. Never touch anything that isn't a plain helper, like groups, bones or the daylight system. A coding agent wrote the script and 45 tests from that plan in about 2 hours.
Results
Then I ran it on the building model above and checked the result. 86 layers created, 17,856 objects moved, every world transform (an object's position, rotation and scale in the scene) unchanged.

15+ designers use it every week now.
Code
The code is on GitHub if your pipeline makes the same mess.