def authenticate(self, login, password):
        if not LDAP_AVAILABLE:
            msg = "The optional library 'ldap' is not available. The users trying to be authenticated with LDAP will not be able to do so. %s tried to do it. " % login
            print(msg, file=sys.stderr)
            log.log(self, log.level.Error, msg)
            return False

        if not password:
            # The Python LDAP module does not provide any error if the password is empty
            return False

        password = str(password)
        ldap_module = _ldap_provider.get_module()
        try:
            ldapobj = ldap_module.initialize(
                self.ldap_uri
            )
        except Exception as e:
            raise LoginErrors.LdapInitializingError(
                e % "Exception initializing the LDAP module: %s"
            )

        dn = "%s@%s" % (login, self.domain)
        pw = password

        try:
            ldapobj.simple_bind_s(dn, pw)
        except ldap.INVALID_CREDENTIALS as e:
            return False
        except Exception as e:
            raise LoginErrors.LdapBindingError(
                "Exception binding to the server: %s" % e
            )
        else:
            ldapobj.unbind_s()
            return True
dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/weblab/core/login/simple/ldap_auth.py/LdapUserAuth.authenticate/swapped operands of `%`