def __verify_username(self, username):
        """Raises an exception if the given username is not valid."""

        if len(username) > self.__max_length or len(username) < 3:
            raise ValueError(
                f"Username must be between 3 and {self.__max_length} characters."
            )
        if any(c not in string.ascii_letters + string.digits for c in username):
            raise ValueError("Usernames can only contain alphanumeric characters.")
def __verify_username ( self , username ) : if len ( username ) > self . __max_length or len ( username ) < 3 : raise ValueError ( f"Username must be between 3 and {self.__max_length} characters." ) if any ( c not in string . ascii_letters + string . digits for c in username ) : raise ValueError ( "Usernames can only contain alphanumeric characters." )
Raises an exception if the given username is not valid.