(self, username, password)
Attempts to bind a user to the LDAP server using the credentials
        supplied.

        .. note::

            Many LDAP servers will grant anonymous access if ``password`` is
            the empty string, causing this method to return :obj:`True` no
            matter what username is given. If you want to use this method to
            validate a username and password, rather than actually connecting
            to the LDAP server as a particular user, make sure ``password`` is
            not empty.

        :param str username: The username to attempt to bind with.
        :param str password: The password of the username we're attempting to
            bind with.
        :return: Returns ``True`` if successful or ``None`` if the credentials
            are invalid.
Attempts to bind a user to the LDAP server using the credentials
        supplied.
Attempts to bind a user to the LDAP server using the credentials supplied .
def bind_user(self, username, password):
        """Attempts to bind a user to the LDAP server using the credentials
        supplied.

        .. note::

            Many LDAP servers will grant anonymous access if ``password`` is
            the empty string, causing this method to return :obj:`True` no
            matter what username is given. If you want to use this method to
            validate a username and password, rather than actually connecting
            to the LDAP server as a particular user, make sure ``password`` is
            not empty.

        :param str username: The username to attempt to bind with.
        :param str password: The password of the username we're attempting to
            bind with.
        :return: Returns ``True`` if successful or ``None`` if the credentials
            are invalid.
        """
        user_dn = self.get_object_details(user=username, dn_only=True)
        if user_dn is None:
            return
        try:
            conn = self.initialize
            _user_dn = user_dn.decode('utf-8') \
                if isinstance(user_dn, bytes) else user_dn
            conn.simple_bind_s(_user_dn, password)
            return True
        except ldap.LDAPError:
            return
def bind_user ( self , username , password ) : user_dn = self . get_object_details ( user = username , dn_only = True ) if user_dn is None : return try : conn = self . initialize _user_dn = user_dn . decode ( 'utf-8' ) if isinstance ( user_dn , bytes ) else user_dn conn . simple_bind_s ( _user_dn , password ) return True except ldap . LDAPError : return