add back sort testcases function from python 3.3.4