Fix printing to stdout in Python 3