def METHOD_NAME(self, fd, events):
    if events & IOLoop.READ:
        try:
            with util.SlowWarning("Slow IO: os.read (session '%s')" % self.desc):
                buf = os.read(fd, BUFSIZ)
        except (OSError, IOError):
            self.poll() # fd probably closed?
            return
        if len(buf) > 0:
            self.write_ttyrec_chunk(buf)
            if self.activity_callback:
                self.activity_callback()
            self.output_buffer += buf
            self._do_output_callback()
        self.poll()
    if events & IOLoop.ERROR:
        self.poll()