I've come up with this so far: https://gist.github.com/JosephJNK/694e4465eac974bceadef48ef97d2d39
I just used 2to3 to convert the script to python3, removed the #! line, and fixed a couple of issues with operator overloading. It successfully produces gcode for me now, but the gcode isn't working on my device. @megrimm, can you see if this works for you?