code: def invite_by_email(self, email, sender=None, request=None, **kwargs):
          
          try:
              user = self.user_model.objects.get(email=email)
          except self.user_model.DoesNotExist:
              # TODO break out user creation process
              if "username" in inspect.getargspec(
                  self.user_model.objects.create_user
              ).args:
                  user = self.user_model.objects.create(
                      username=self.get_username(),
                      email=email,
                      password=self.user_model.objects.make_random_password(),
                  )
              else:
                  user = self.user_model.objects.create(
                      email=email, password=self.user_model.objects.make_random_password()
                  )
              user.is_active = False
              user.save()
          self.send_invitation(user, sender, **kwargs)
          return user
docs: Creates an inactive user with the information we know and then sends
          an invitation email for that user to complete registration.
  
          If your project uses email in a different way then you should make to
          extend this method as it only checks the `email` attribute for Users.