def on_response(self, response):
        if not self.first_server_chunk_received:
            self.first_server_chunk_received = True
            if (not self.first_client_chunk_received and
                (response.startswith("220 ") or response.startswith("220-"))):
                self.smtp_detected = True

        if not self.smtp_detected:
            return response

        if self.ehlo_response_pending:
            # This is supposed to be a response to EHLO
            self.ehlo_response_pending = False
            if not response.startswith("250-"):
                # Unexpected response to EHLO -- stop analyzing/attacking
                return response

            lines = [l.rstrip() for l in response.splitlines()]
            starttls_line_index = -1
            for i in range(len(lines)):
                line = lines[i]
                if line[4:].lower().startswith("starttls"):
                    starttls_line_index = i
                    break
            else:
                # STARTTLS not found -- stop analyzing/attacking
                self.smtp_detected = False
                self.log(logging.DEBUG, "No STARTTLS in EHLO response")
                return response

            if starttls_line_index == 1 - len(lines):
                # STARTTLS line was the last line -- drop it and modify the
                # preceding line as required by the protocol.
                lines = lines[:starttls_line_index]
                lines[-1] = lines[-1][0:3] + " " + lines[-1][4:]
            else:
                # STARTTLS line was not the last line -- just drop it.
                lines = lines[:starttls_line_index] + lines[starttls_line_index + 1:]
            response = "\r\n".join(lines) + "\r\n"
            self.server_starttls_stripped = True
            self.log(logging.DEBUG, "Stripped STARTTLS from EHLO response")

        return response
dataset/ETHPy150Open google/nogotofail/nogotofail/mitm/connection/handlers/data/smtp.py/SmtpStartTlsStripHandler.on_response/swapped operands of `-`