Thanks to your write up, I was able to get x3g files written! I'm on Windows 10 and used Notepad to edit the py file. Note, I had to make sure that when I commented out the "return machine if machine..." line the '#' symbol was lined up with other lines that were being commented out, and got the text of the line lined up with other such lines.
You helped a ton, kind human.