python 3 porting: syntax adaptations