Added python 3 support. (thx @yegle)