old_contents: # -*- coding: utf-8 -*-
  from __future__ import unicode_literals, absolute_import
  
  from django.contrib.auth.models import BaseUserManager
  from django.core.exceptions import ValidationError
  from django.core.mail import mail_admins
  from django.core.validators import validate_email
  from django.template import loader, Context
  from django.utils import timezone
  from django.utils.html import strip_tags
  from django.utils.translation import ugettext as _
  
  
  class EmailUserManager(BaseUserManager):
  
      def _create_user(self, email, password,
                       is_staff, is_superuser, **extra_fields):
          """
          Creates and saves a User with the given email and password.
          """
          now = timezone.now()
          if not email:
              raise ValueError(_('The given email must be set'))
          try:
              email = self.normalize_email(email)
              validate_email(email)
          except ValidationError:
              raise ValueError(_('The given email must be a valid email'))
  
          user = self.model(email=email,
                            is_staff=is_staff, is_active=True,
                            is_superuser=is_superuser, last_login=now,
                            date_joined=now, **extra_fields)
          user.set_password(password)
          user.save(using=self._db)
          return user
  
      def create_user(self, email, password=None, is_staff=False,
                      **extra_fields):
          return self._create_user(email, password, is_staff, False,
                                   **extra_fields)
  
      def create_superuser(self, email, password, **extra_fields):
          return self._create_user(email, password, True, True,
                                   **extra_fields)
  
new_contents: # -*- coding: utf-8 -*-
  from __future__ import unicode_literals, absolute_import
  
  from django.contrib.auth.models import BaseUserManager
  from django.core.exceptions import ValidationError
  from django.core.validators import validate_email
  from django.utils import timezone
  from django.utils.translation import ugettext as _
  
  
  class EmailUserManager(BaseUserManager):
  
      def _create_user(self, email, password,
                       is_staff, is_superuser, **extra_fields):
          """
          Creates and saves a User with the given email and password.
          """
          now = timezone.now()
          if not email:
              raise ValueError(_('The given email must be set'))
          try:
              email = self.normalize_email(email)
              validate_email(email)
          except ValidationError:
              raise ValueError(_('The given email must be a valid email'))
  
          user = self.model(email=email,
                            is_staff=is_staff, is_active=True,
                            is_superuser=is_superuser, last_login=now,
                            date_joined=now, **extra_fields)
          user.set_password(password)
          user.save(using=self._db)
          return user
  
      def create_user(self, email, password=None, is_staff=False,
                      **extra_fields):
          return self._create_user(email, password, is_staff, False,
                                   **extra_fields)
  
      def create_superuser(self, email, password, **extra_fields):
          return self._create_user(email, password, True, True,
                                   **extra_fields)
  
subject: clean unused imports