Added Python 2 compatibility, prevents printing if not needed.