def delete_txt_record(change_id, account_number, domain, token):
    """
    Delete the TXT record for the given domain and token

    :param change_id: tuple of domain/token
    :param account_number:
    :param domain: FQDN
    :param token: challenge to delete
    :return:
    """
    _check_conf()
    function = inspect.currentframe().f_code.co_name
    log_data = {
        "function": function,
        "fqdn": domain,
        "token": token,
        "change": change_id,
        "account": account_number,
    }
    zone = _get_zone_name(domain)
    records = _get_txt_records(domain)
    found = False
    for each in records['answers']:
        if token in each['answer']:
            found = True
            each['answer'].remove(token)
            if len(each['answer']) == 0:
                try:
                    path = f"/v1/zones/{zone}/{domain}/TXT"
                    _delete(path)
                    log_data["message"] = "TXT record successfully deleted"
                    current_app.logger.debug(log_data)
                except Exception as err:
                    capture_exception()
                    log_data["Exception"] = err
                    log_data["message"] = "Unable to delete TXT record"
                    current_app.logger.debug(log_data)
            else:
                try:
                    _patch_txt_records(domain, records)
                    log_data["message"] = "TXT record successfully deleted"
                    current_app.logger.debug(log_data)
                except Exception as err:
                    capture_exception()
                    log_data["Exception"] = err
                    log_data["message"] = "Unable to delete TXT record"
                    current_app.logger.debug(log_data)
    # Since the matching token is not in DNS, there is nothing to delete
    if not found:
        log_data["message"] = "Unable to delete TXT record: Token not found in existing TXT records"
        current_app.logger.debug(log_data)
        return

    Delete the TXT record for the given domain and token

    :param change_id: tuple of domain/token
    :param account_number:
    :param domain: FQDN
    :param token: challenge to delete
    :return:
    
lemur/plugins/lemur_acme/nsone.py