def write(self, data):
    return logging.log(self.level, data)

def fileno(self):
    return self.pipe[1]

def close(self):
    if self._run:
        self._run = False
while self._run is not None:
    time.sleep(1)
os.close(self.pipe[0])
os.close(self.pipe[1])
How can I implement a POSIX file descriptor in Python 3?