Remove octal literals from the tests

It looks like these weren't intended to be octal literals. In Python 2
they are, though, and the leading-zero-octal syntax is a syntax error
under Python 3.
Avoid the use of .iteritems

iteritems is no longer present in Python 3, having been replaced with
.items. Since .items will work in both, switch over to that.
Avoid the use of xrange

xrange is replaced with range in Python 3, and since range works in
both, switch to that.
Avoid a direct index on a .values

In Python 3 this is a view object rather than a list, and is not
indexable. The simplest fix is to call list() on the view object first,
which is a no-op in Python 2.
Avoid old-style cmp arguments to sorts

The modern Python way is to use a key= argument, and indeed cmp is gone
in Python 3.
Remove an unneeded assert from stable random

This assert is no longer checking a valid condition in Python 3, where
the type is 'bytes' rather than 'str'. The simplest solution is just to
remove the assert.

The duck typing principle says it shouldn't be there anyway.
Switch over to new-style printing

This is compatible both with Python 2 and Python 3.
Use __lt__ for defining the total order on team scores

__cmp__ is no longer supported in recent Python versions, nor are
ordering comparisons between incompatible types.
Explicitly call list() on .keys results

Even for ordered dictionaries, in Python 3 the .keys object is not
indexable.
Convert to tuples for the match range comparison

While these contain the same data in principle, in Python 3 type
differences mean the compared unequal.
Make league score order deterministic in case of ties

This is not entirely fair, but this is at least better than
nondeterminism.