@classmethod
    def inbound_entry_exists(cls, contact_doc_type, contact_id, from_timestamp, to_timestamp=None):
        """
        Checks to see if an inbound sms or call exists for the given caller.

        contact_doc_type - The doc_type of the contact (e.g., "CommCareCase")
        contact_id - The _id of the contact
        after_timestamp - The datetime after which to check for the existence of an entry

        return          True if an sms/call exists in the log, False if not.
        """
        if cls.__name__ == "MessageLog":
            raise NotImplementedError("Not implemented for base class")
        from_timestamp_str = json_format_datetime(from_timestamp)
        to_timestamp_str = json_format_datetime(to_timestamp or datetime.utcnow())
        reduced = cls.view("sms/by_recipient",
            startkey=[contact_doc_type, contact_id, cls.__name__, INCOMING, from_timestamp_str],
            endkey=[contact_doc_type, contact_id, cls.__name__, INCOMING, to_timestamp_str],
            reduce=True).all()
        if reduced:
            return (0 > reduced[0]['value'])
        else:
            return False
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/sms/models.py/MessageLog.inbound_entry_exists/swapped operands of `>`