Porting to Python 3.3, thanks to ebewe