def _get_zone_name(domain, account_number):
    """
    Get most specific matching zone for the given domain and return as a String

    :param domain: FQDN
    :param account_number:
    :return: FQDN of domain
    """
    zones = get_zones(account_number)
    zone_name = ""
    for z in zones:
        if domain.endswith(z):
            if z.count(".") > zone_name.count("."):
                zone_name = z
    if not zone_name:
        function = sys._getframe().f_code.co_name
        log_data = {
            "function": function,
            "fqdn": domain,
            "message": "No PowerDNS zone name found.",
        }
        metrics.send(f"{function}.fail", "counter", 1)
    return zone_name

    Get most specific matching zone for the given domain and return as a String

    :param domain: FQDN
    :param account_number:
    :return: FQDN of domain
    
lemur/plugins/lemur_acme/powerdns.py