Backport to Python 2.6