Add Python3 support.

The actual work was done by @hegusung.