backported to Python 2.6