def deactivate_certificate(self, certificate):
        """Deactivates an Entrust certificate, as long as it is still active, and not already deactivated. """
        log_data = {
            "function": f"{__name__}.{sys._getframe().f_code.co_name}",
            "external_id": f"{certificate.external_id}"
        }

        # backwards compatible change to protect this endpoint from being used in production
        for option in self.options:
            if option.get("name") == "staging_account" and option.get("value") is True:
                raise Exception("This issuer is not configured to deactivate certificates.")

        # Let's first check the status of the certificate
        base_url = current_app.config.get("ENTRUST_URL")
        status_url = f"{base_url}/certificates/{certificate.external_id}"
        response = self.session.get(status_url)

        try:
            data = handle_response(response)
        except (ValueError, Exception):
            # if the certificate cannot be found, there is no need to deactivate it
            log_data['message'] = "No certificate found for the ID"
            current_app.logger.info(log_data)
            return 200

        if data and data['status'].lower() == 'active':
            deactivate_url = f"{base_url}/certificates/{certificate.external_id}/deactivations"
            response = self.session.post(deactivate_url)
            metrics.send("entrust_deactivate_certificate", "counter", 1)
            return handle_response(response)
        else:
            # the certificate is no longer valid, or doesn't exist and cannot be deactivated
            return 200
Deactivates an Entrust certificate, as long as it is still active, and not already deactivated. 
lemur/plugins/lemur_entrust/plugin.py