I would change the pass on line 182 to a print "error". If "error" prints then it is a gcode formatting problem. I used Slic3r to make my gcode and it puts space between each part. I was lazy and didn't try to generalize for the broader spec.