def check(file_to_check, testmode, debug):
    '\n    Function open file, read each line and complete a dictionnary\n    For each entry, launch check url : http/https or launch resolution then ping for MX/NS entry\n    If one url not respond, launch email to alert   \n\n    Parameters\n    ----------\n    file_to_check : string\n        This is the name of the fillethat contain list of url must be checked\n        and mail  for alert\n    testmode : string\n        This value is 0 by defaut and is to 1 if user launchscript on test mode:\n        print enabled and no mail send\n    debug : string\n        This value is 0 by defaut and is to 1 if user launchscript on debug mode:\n        more print enabled and no mail send\n\n    Returns\n    -------\n    None.\n\n    '
    try:
        file = open(file_to_check, 'r')
    except:
        exit('open file failed')
    lines = file.readlines()
    file.close()
    url_dict = {}
    for line in lines:
        line = line.replace('\n', '')
        line = line.replace(' ', '\t')
        line = line.replace('\t\t\t', '\t')
        line = line.replace('\t\t', '\t')
        line = line.replace('http://', '')
        line = line.replace('https://', '')
        element = line.split('\t')
        cle = element[0]
        data = element[1]
        url_dict[cle] = data
    if (debug == 1):
        print('Url dict : \n', url_dict)
    if (testmode == 1):
        print('Check :')
    for (url, mail) in url_dict.items():
        if (('ns://' not in url) and ('mx://' not in url) and ('ping://' not in url)):
            availability = str(request_url(url))
            if ((availability == '200') or (availability == '301') or (availability == '302')):
                request_url_result = 'UP'
            else:
                request_url_result = 'DOWN'
            if (testmode == 1):
                print('url : ', url, '  -> mail : ', mail, ' Result :', request_url_result)
            elif (request_url_result == 'DOWN'):
                alert_mail(mail, request_url_result, url)
        elif ('ns://' in url):
            request_url_result = ping_name(url, 'NS')
            if (testmode == 1):
                print('url : ', url, '  -> mail : ', mail, ' Result NS :', request_url_result)
            elif (request_url_result == 'DOWN'):
                alert_mail(mail, request_url_result, url)
        elif ('mx://' in url):
            request_url_result = ping_name(url, 'MX')
            if (testmode == 1):
                print('url : ', url, '  -> mail : ', mail, ' Result MX :', request_url_result)
            elif (request_url_result == 'DOWN'):
                alert_mail(mail, request_url_result, url)
        elif ('ping://' in url):
            url = url.replace('ping://', '')
            request_url_result = ping_ip(url)
            if (testmode == 1):
                print('url : ', url, '  -> mail : ', mail, ' Result Ping :', request_url_result)
            elif (request_url_result == 'DOWN'):
                alert_mail(mail, request_url_result, url)
        elif (testmode == 1):
            print('url : ', url, '  -> mail : ', mail, 'ignored')
    exit()
Function open file, read each line and complete a dictionnary
For each entry, launch check url : http/https or launch resolution then ping for MX/NS entry
If one url not respond, launch email to alert   

Parameters
----------
file_to_check : string
    This is the name of the fillethat contain list of url must be checked
    and mail  for alert
testmode : string
    This value is 0 by defaut and is to 1 if user launchscript on test mode:
    print enabled and no mail send
debug : string
    This value is 0 by defaut and is to 1 if user launchscript on debug mode:
    more print enabled and no mail send

Returns
-------
None.
def check(file_to_check, testmode, debug):
    '\n    Function open file, read each line and complete a dictionnary\n    For each entry, launch check url : http/https or launch resolution then ping for MX/NS entry\n    If one url not respond, launch email to alert   \n\n    Parameters\n    ----------\n    file_to_check : string\n        This is the name of the fillethat contain list of url must be checked\n        and mail  for alert\n    testmode : string\n        This value is 0 by defaut and is to 1 if user launchscript on test mode:\n        print enabled and no mail send\n    debug : string\n        This value is 0 by defaut and is to 1 if user launchscript on debug mode:\n        more print enabled and no mail send\n\n    Returns\n    -------\n    None.\n\n    '
    try:
        file = open(file_to_check, 'r')
    except:
        exit('open file failed')
    lines = file.readlines()
    file.close()
    url_dict = {}
    for line in lines:
        line = line.replace('\n', )
        line = line.replace(' ', '\t')
        line = line.replace('\t\t\t', '\t')
        line = line.replace('\t\t', '\t')
        line = line.replace('http://', )
        line = line.replace('https://', )
        element = line.split('\t')
        cle = element[0]
        data = element[1]
        url_dict[cle] = data
    if (debug == 1):
        print('Url dict : \n', url_dict)
    if (testmode == 1):
        print('Check :')
    for (url, mail) in url_dict.items():
        if (('ns://' not in url) and ('mx://' not in url) and ('ping://' not in url)):
            availability = str(request_url(url))
            if ((availability == '200') or (availability == '301') or (availability == '302')):
                request_url_result = 'UP'
            else:
                request_url_result = 'DOWN'
            if (testmode == 1):
                print('url : ', url, '  -> mail : ', mail, ' Result :', request_url_result)
            elif (request_url_result == 'DOWN'):
                alert_mail(mail, request_url_result, url)
        elif ('ns://' in url):
            request_url_result = ping_name(url, 'NS')
            if (testmode == 1):
                print('url : ', url, '  -> mail : ', mail, ' Result NS :', request_url_result)
            elif (request_url_result == 'DOWN'):
                alert_mail(mail, request_url_result, url)
        elif ('mx://' in url):
            request_url_result = ping_name(url, 'MX')
            if (testmode == 1):
                print('url : ', url, '  -> mail : ', mail, ' Result MX :', request_url_result)
            elif (request_url_result == 'DOWN'):
                alert_mail(mail, request_url_result, url)
        elif ('ping://' in url):
            url = url.replace('ping://', )
            request_url_result = ping_ip(url)
            if (testmode == 1):
                print('url : ', url, '  -> mail : ', mail, ' Result Ping :', request_url_result)
            elif (request_url_result == 'DOWN'):
                alert_mail(mail, request_url_result, url)
        elif (testmode == 1):
            print('url : ', url, '  -> mail : ', mail, 'ignored')
    exit()