def ping_name(name, dns_type):
    '\n    Function to resolve name and ping this host.\n    print the result of ping\n\n    Parameters\n    ----------\n    name : string\n        This variable contain the name (host) must be checked\n    dns_type : string\n        This variable contain the DNS type : A, NS, MX \n\n    Returns\n    -------\n    status : String\n        Status result : UP or DOWN\n\n    '
    name = name.replace('ns://', '')
    name = name.replace('mx://', '')
    if (dns_type == 'A'):
        try:
            addr1 = socket.gethostbyname_ex(name)
            print('Resolution -> {}'.format(addr1[2]))
            name = addr1[2]
        except:
            print('Resolution failed')
    if (dns_type == 'MX'):
        try:
            answers = dns.resolver.resolve(name, 'MX')
            for rdata in answers:
                addr1 = socket.gethostbyname_ex(str(rdata.exchange))
                name = addr1[2]
                if (ping_ip(name) == 'UP'):
                    return 'UP'
            return ping_ip(name)
        except:
            print('Resolution failed')
            return 'DOWN'
    if (dns_type == 'NS'):
        try:
            answers = dns.resolver.resolve(name, 'NS')
            for rdata in answers:
                addr1 = socket.gethostbyname_ex(str(rdata.target))
                name = addr1[2]
                for srv in name:
                    if (ping_ip(srv) == 'UP'):
                        return 'UP'
            return ping_ip(name)
        except:
            print('Resolution failed')
            return 'DOWN'
Function to resolve name and ping this host.
print the result of ping

Parameters
----------
name : string
    This variable contain the name (host) must be checked
dns_type : string
    This variable contain the DNS type : A, NS, MX 

Returns
-------
status : String
    Status result : UP or DOWN
def ping_name(name, dns_type):
    '\n    Function to resolve name and ping this host.\n    print the result of ping\n\n    Parameters\n    ----------\n    name : string\n        This variable contain the name (host) must be checked\n    dns_type : string\n        This variable contain the DNS type : A, NS, MX \n\n    Returns\n    -------\n    status : String\n        Status result : UP or DOWN\n\n    '
    name = name.replace('ns://', )
    name = name.replace('mx://', )
    if (dns_type == 'A'):
        try:
            addr1 = socket.gethostbyname_ex(name)
            print('Resolution -> {}'.format(addr1[2]))
            name = addr1[2]
        except:
            print('Resolution failed')
    if (dns_type == 'MX'):
        try:
            answers = dns.resolver.resolve(name, 'MX')
            for rdata in answers:
                addr1 = socket.gethostbyname_ex(str(rdata.exchange))
                name = addr1[2]
                if (ping_ip(name) == 'UP'):
                    return 'UP'
            return ping_ip(name)
        except:
            print('Resolution failed')
            return 'DOWN'
    if (dns_type == 'NS'):
        try:
            answers = dns.resolver.resolve(name, 'NS')
            for rdata in answers:
                addr1 = socket.gethostbyname_ex(str(rdata.target))
                name = addr1[2]
                for srv in name:
                    if (ping_ip(srv) == 'UP'):
                        return 'UP'
            return ping_ip(name)
        except:
            print('Resolution failed')
            return 'DOWN'