code: def isatty(file):
      
      if (multiprocessing.current_process().name != 'MainProcess' or
          threading.current_thread().getName() != 'MainThread'):
          return False
  
      if hasattr(file, 'isatty'):
          return file.isatty()
      elif (OutStream is not None and
            isinstance(file, (OutStream, IPythonIOStream)) and
            ((hasattr(file, 'name') and file.name == 'stdout') or
             (hasattr(file, 'stream') and
                 isinstance(file.stream, PyreadlineConsole)))):
          # File is an IPython OutStream or IOStream and
          #    File name is 'stdout' or
          #    File wraps a Console
          return True
      return False
docs: Returns `True` if `file` is a tty.
  
      Most built-in Python file-like objects have an `isatty` member,
      but some user-defined types may not, so this assumes those are not
      ttys.