[python3] Minor adjustments for py2/3 compatibility