Ensure sys.stdout has an istty method