code: def add_user(self, attrs):
          
          ldap_client = self._bind()
          # encoding crap
          attrs_srt = self.attrs_pretreatment(attrs)
  
          attrs_srt[self._byte_p2('objectClass')] = self.objectclasses
          # construct is DN
          dn = \
              self._byte_p2(self.dn_user_attr) + \
              self._byte_p2('=') + \
              self._byte_p2(ldap.dn.escape_dn_chars(
                          attrs[self.dn_user_attr]
                      )
                  ) + \
              self._byte_p2(',') + \
              self._byte_p2(self.userdn)
          # gen the ldif first add_s and add the user
          ldif = modlist.addModlist(attrs_srt)
          try:
              ldap_client.add_s(dn, ldif)
          except ldap.ALREADY_EXISTS as e:
              raise UserAlreadyExists(attrs[self.key], self.backend_name)
          except Exception as e:
              ldap_client.unbind_s()
              self._exception_handler(e)
          ldap_client.unbind_s()
docs: add a user