code: 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
              conn.simple_bind_s(user_dn.decode('utf-8'), password)
              return True
          except ldap.LDAPError:
              return
docs: 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.