def initializeConnection(self): if not self.dc_ip: self.dc_ip = self.getDC_IP(self.domain) con = ldap.initialize('ldap://{}'.format(self.dc_ip)) con.set_option(ldap.OPT_REFERRALS, 0) return con