added python3 emulation code + six + fixed up print calls