docs: def new(cls,
              username,
              password=None,
              email=None,
              first_name="",
              last_name="",
              login_method=None,
              role="MEMBER"
              ):
          """
          Create a new user
          :param username: str
          :param password: str
          :param email: str
          :param first_name: str
          :param last_name: str
          :param login_method: str
          :param role: str
          :return: AuthUser
          """
          data = {
              "first_name": first_name,
              "last_name": last_name,
              "email": email
          }
  
          if not password:
              password = utils.generate_random_string()
  
          username = username.strip().lower()
          if "@" in username and not email:
              if not utils.is_email_valid(username):
                  exceptions.AuthError(_("Invalid username"))
              data["email"] = username
          elif email:
              if not utils.is_email_valid(email):
                  exceptions.AuthError(_("Invalid username"))
  
          if not utils.is_username_valid(username):
              exceptions.AuthError(_("Invalid username"))
          if not utils.is_password_valid(password):
              raise exceptions.AuthError(_("Password is invalid"))
  
          if cls.get_by_username(username):
              raise exceptions.AuthError(_("Username exists already"))
          _email = data.get("email")
          if _email:
              if cls.get_by_email(_email):
                  raise exceptions.AuthError(_("Email address exists already"))
  
          role = AuthUserRole.get_by_name(role or "MEMBER")
          if not role:
              raise exceptions.AuthError(_("Invalid user role"))
  
          data.update({
              "username": username,
              "password_hash": cls.encrypt_password(password),
              "email_verified": False,
              "login_method": login_method,
              "role": role,
              "status": cls.STATUS_ACTIVE
          })
          user = cls.create(**data)
          user.reset_secret_key()
          return user