More bug fixes for autosort. Also added more robust unittests using
random.shuffle.
Automatic Py3k merge for testing