How not to write Python: Part 1 (Courtesy of Adobe)
voxel.dl.sourceforge.net
voxel.dl.sourceforge.net
Notice how all the leaf nodes (ends of if/then branches) do only one thing: set isDirty to 0 or 1.
And, all the if/then conditions are just thresholds of one variable against a constant threshold.
The later part seems to be exceptions to the above tree. I've never heard of this, but it seems like what they used:
http://weka.sourceforge.net/doc/weka/classifiers/rules/Ridor...
This is just machine-generated J48Graft code. Amusing, but not as terrible as it appears at first blush.
2) It isn't that ugly! If you know what the code is supposed to do (which should be clear from documentation or just the purpose of the program) and it fails in some cases, take that failing case and go through the if-else statements manually.
If this is machine-generated code the real program is the one outputting this script. The big machine-generated statements are just data from that program. That program may be much better structured.