code: def isInteractive():
      
      if sys.stdout.isatty() and os.name != 'nt':
          #Hopefully everything but ms supports '\r'
          try:
              import threading
          except ImportError:
              return False
          else:
              return True
      else:
          return False
docs: A basic check of if the program is running in interactive mode