def create_certificate(self, csr, issuer_options):
        """
        Creates an Entrust certificate.

        :param csr:
        :param issuer_options:
        :return: :raise Exception:
        """
        log_data = {
            "function": f"{__name__}.{sys._getframe().f_code.co_name}",
            "message": "Requesting options",
            "options": issuer_options
        }
        current_app.logger.info(log_data)

        if current_app.config.get("ENTRUST_USE_DEFAULT_CLIENT_ID"):
            # The ID of the primary client is 1.
            client_id = 1
        elif current_app.config.get("ENTRUST_CLIENT_IDS"):
            client_id = choice(current_app.config.get("ENTRUST_CLIENT_IDS"))
        else:
            client_id = get_client_id(self.session, issuer_options.get("organization"))
        log_data = {
            "function": f"{__name__}.{sys._getframe().f_code.co_name}",
            "message": f"Organization id: {client_id}"
        }
        current_app.logger.info(log_data)

        url = current_app.config.get("ENTRUST_URL") + "/certificates"

        data = process_options(issuer_options, client_id, csr)
        data["csr"] = csr

        response_dict = order_and_download_certificate(self.session, url, data)

        external_id = response_dict['trackingId']
        cert = response_dict['endEntityCert']
        if len(response_dict['chainCerts']) < 2:
            # certificate signed by CA directly, no ICA included in the chain
            chain = None
        else:
            chain = response_dict['chainCerts'][1]

        if current_app.config.get("ENTRUST_CROSS_SIGNED_RSA_L1K") and get_key_type_from_certificate(cert) == "RSA2048":
            chain = current_app.config.get("ENTRUST_CROSS_SIGNED_RSA_L1K")
        if current_app.config.get("ENTRUST_CROSS_SIGNED_ECC_L1F") and get_key_type_from_certificate(cert) == "ECCPRIME256V1":
            chain = current_app.config.get("ENTRUST_CROSS_SIGNED_ECC_L1F")

        log_data["message"] = "Received Chain"
        log_data["options"] = f"chain: {chain}"
        current_app.logger.info(log_data)

        return cert, chain, external_id

        Creates an Entrust certificate.

        :param csr:
        :param issuer_options:
        :return: :raise Exception:
        
lemur/plugins/lemur_entrust/plugin.py