code: def read_stdin():
      
      if sys.stdin.isatty() and sys.stdout.isatty():
          print('\nReading from stdin until end of file (Ctrl + D)...')
  
      return sys.stdin.read()
docs: Read text from stdin, and print a helpful message for ttys.