High priority changes for Python 3

I’ve stripped my changes down to the ones I think are important for testing and for keeping it working with Python 2. Roughly in order of priority they are:

1. The runxlrd.py script
2. Broken reference to PY3 flag
3. Make test work in Python 2.6
4. Three commits with some small ports to the code that you have already ported

I’ll leave the other changes, including documenting Python 3 support, until later.