def _get_client(self):
    username = ','.join([('uid=%s' % self.settings.username), self.user_base_dn])
    try:
        client = ldap.initialize(self.settings.backend_url)
        client.simple_bind_s(username, self.settings.password)
    except ldap.LDAPError as e:
        six.reraise(UnauthorizedError, e)
    return client
def _get_client(self):
    username = ','.join([('uid=%s' % self.settings.username), self.user_base_dn])
    try:
        client = ldap.initialize(self.settings.backend_url)
        client.simple_bind_s(username, self.settings.password)
    except ldap.LDAPError as e:
        six.reraise(UnauthorizedError, e)
    return client