[python3] Use six module for py2/3 compatibility