user = 'CN=surname name,OU=UsrAccounts,DC=company-intranet,DC=net'
pw = '***'
uri = 'ldap://server.company-intranet.net:389'
lc = ldap.initialize(uri, trace_level=0)
lc.set_option(ldap.OPT_REFERRALS, 0)
lc.set_option(ldap.OPT_PROTOCOL_VERSION, 3)
lc.bind_s(user, pw)
pw = '***'
uri = 'ldap://server.company-intranet.net:389'
lc = ldap.initialize(uri, trace_level=0)
lc.set_option(ldap.OPT_REFERRALS, 0)
lc.set_option(ldap.OPT_PROTOCOL_VERSION, 3)
lc.bind_s(user, pw)