[Python3] introduce python3 compatibility