def _create_user(self, username, email, password,
                     is_staff, is_superuser, is_active=True, **extra_fields):
        if not username:
            raise ValueError('The given username must be set')
        email = self.normalize_email(email)
        user = self.model(username=username, email=email,
                          is_staff=is_staff, is_active=is_active,
                          is_superuser=is_superuser, **extra_fields)
        user.set_password(password)
        user.save(using=self._db)
        return user
Creates and saves a User with the given username, email and password.
dataset/ETHPy150Open torchbox/wagtail/wagtail/tests/customuser/models.py/CustomUserManager._create_user