def connect():

    ###########################################
    #
    # 该函数用于测试数据库连接状态
    #
    ###########################################

    # MySQL的用户:usr, 密码:psw, 端口port,数据库名db

    usr = ''
    psw = ''
    host = ''
    port = 

    conn = pymysql.connect(
        host=host,
        user=usr,
        passwd=psw,
        port=port,
        charset='utf8'
    )

    return conn


def recon():

    ###########################################
    #
    # 该函数用于数据库链接异常时重连
    #
    ###########################################

    try:

        connect()

    except Exception as e:

        print('Err:%s' % e)

    else:

        return 1