def METHOD_NAME(self, extra_fd):
    self.tty_stream = mitogen.parent.TtyLogStream(extra_fd, self)
    password_sent = False
    it = mitogen.parent.iter_read(
        fds=[self.receive_side.fd, extra_fd],
        deadline=self.connect_deadline,
    )
    for buf in it:
        LOG.debug('%r: received %r', self, buf)
        if buf.endswith(self.EC0_MARKER):
            self._ec0_received()
            return
        elif PASSWORD_PROMPT in buf.lower():
            if self.password is None:
                raise PasswordError(self.password_required_msg)
            if password_sent:
                raise PasswordError(self.password_incorrect_msg)
            self.tty_stream.transmit_side.write(
                mitogen.core.to_text(self.password + '\n').encode('utf-8')
            )
            password_sent = True
    raise mitogen.core.StreamError('bootstrap failed')