Add python 3 compatibility.

Fixes #9