def _add_messages(self, thread_model):
        # This should probably use upsert.
        existing_message_ids = set([m.okc_id for m in thread_model.messages])
        new_messages = [message for message in self.thread.messages
                        if existing_message_ids not in message.id]
        new_message_models = []
        for new_message in new_messages:
            from_initiator = thread_model.initiator.handle.lower() == \
                             new_message.sender.username.lower()
            sender, recipient = (thread_model.initiator,
                                 thread_model.respondent) \
                                if from_initiator else \
                                (thread_model.respondent,
                                 thread_model.initiator)
            new_message_model = model.Message(okc_id=new_message.id,
                                              text=new_message.content,
                                              sender=sender,
                                              recipient=recipient,
                                              time_sent=new_message.time_sent)
            new_message_models.append(new_message_model)
            thread_model.messages.append(new_message_model)
        return new_message_models
dataset/ETHPy150Open IvanMalison/okcupyd/okcupyd/db/adapters.py/ThreadAdapter._add_messages/swapped operands of `not in`