It wasn't particularly hard, just a bit laborious. I exported sample cells and checked it against the python PCell as I went. The hardest part was probably getting used to TCL syntax but that's more my failing than anything else. Apart from that I just followed the logic of your code with some artificial box stack and then a bit of reasoning about the extra GDS layers.
Here's the file. It's straight python but wrapped in an xml file. The development is done in a IDE like environment in Klayout which is nice coz you can debug, step through lines and automatically refresh the PCell instantly after making a code change