return whether the file is connected to a tty or not

def isatty(self):
        "return whether the file is connected to a tty or not"
        try:
            return os.isatty(self._fileno)
        except OSError, e:
            raise IOError(*e.args)