.. versionadded:: 2019.2.0

    Check whether a domain name in the current zone is available for use.

    :param name: The DNS name to query.

    :param region: The region to query for the DNS name in question.

    CLI Example:

    .. code-block:: bash

        salt-call azurearm_network.check_dns_name_availability testdnsname westus

def check_dns_name_availability(name, region, **kwargs):
    '''
    .. versionadded:: 2019.2.0

    Check whether a domain name in the current zone is available for use.

    :param name: The DNS name to query.

    :param region: The region to query for the DNS name in question.

    CLI Example:

    .. code-block:: bash

        salt-call azurearm_network.check_dns_name_availability testdnsname westus

    '''
    netconn = __utils__['azurearm.get_client']('network', **kwargs)
    try:
        check_dns_name = netconn.check_dns_name_availability(
            location=region,
            domain_name_label=name
        )
        result = check_dns_name.as_dict()
    except CloudError as exc:
        __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs)
        result = {'error': str(exc)}

    return result