def METHOD_NAME(self):
    logger.info("Searching for SDD Mandates that must be set to Expired")
    expire_limit_date = datetime.today() + relativedelta(
        months=-NUMBER_OF_UNUSED_MONTHS_BEFORE_EXPIRY
    )
    expired_mandates = self.search(
        [
            "|",
            ("last_debit_date", "=", False),
            ("last_debit_date", "<=", expire_limit_date),
            ("state", "=", "valid"),
            ("signature_date", "<=", expire_limit_date),
        ]
    )
    if expired_mandates:
        expired_mandates.write({"state": "expired"})
        for mandate in expired_mandates:
            mandate.message_post(
                body=_(
                    "Mandate automatically set to expired after %d months without use."
                )
                % NUMBER_OF_UNUSED_MONTHS_BEFORE_EXPIRY
            )
            logger.info("SDD Mandate set to expired: ID %s" % (mandate.id))
    else:
        logger.info("0 SDD Mandates had to be set to Expired")