Script is equivalent, but now also runs under ancient Python 2.6. Goes part way to addressing issue #847.