def METHOD_NAME(self, line, match):
    LOG.debug('%r: (password prompt): %r',
              self.stream.name, line.decode('utf-8', 'replace'))
    if self.stream.conn.options.password is None:
        self.stream.conn._fail_connection(
            PasswordError(password_required_msg)
        )
        return
    if self.password_sent:
        self.stream.conn._fail_connection(
            PasswordError(password_incorrect_msg)
        )
        return
    self.stream.transmit_side.write(
        (self.stream.conn.options.password + '\n').encode('utf-8')
    )
    self.password_sent = True