code: def direct_bind(self, username, password):
          
          log.debug("Performing direct bind")
  
          ctx = {'username':username, 'password':password}
          scope = self.config.get('SCOPE', ldap.SCOPE_SUBTREE)
          user = self.config['BIND_DN'] % ctx
  
          try:
              log.debug("Binding with the BIND_DN %s" % user)
              self.conn.simple_bind_s(user, password)
          except ldap.INVALID_CREDENTIALS:
              if self._raise_errors:
                  raise ldap.INVALID_CREDENTIALS("Unable to do a direct bind with BIND_DN %s" % user)
              return None
          results = self.conn.search_s(user, scope, attrlist=self.attrlist)
          self.conn.unbind_s()
          return self.format_results(results)
docs: Bind to username/password directly