Consider swapping to a logger instead of using only print. Or make a wrapper around print(<str>, sys.stderr) called eprint to abstract that sys interaction away.