Backport to Python 2.4.