def __format__(self, format_spec: str) -> str:
        """Format the number.

        Args:
            format_spec: The format specifier.

        Returns:
            The formatted number.

        Raises:
            VarValueError: If the format specifier is not supported.
        """
        from .sequence import (
            get_decimal_string_operation,
            get_decimal_string_separator_operation,
        )

        separator = ""

        if format_spec and format_spec[:1] == ",":
            separator = ","
            format_spec = format_spec[1:]
        elif format_spec and format_spec[:1] == "_":
            separator = "_"
            format_spec = format_spec[1:]

        if (
            format_spec
            and format_spec[-1] == "f"
            and format_spec[0] == "."
            and format_spec[1:-1].isdigit()
        ):
            how_many_decimals = int(format_spec[1:-1])
            return f"{get_decimal_string_operation(self, Var.create(how_many_decimals), Var.create(separator))}"

        if not format_spec and separator:
            return (
                f"{get_decimal_string_separator_operation(self, Var.create(separator))}"
            )

        if format_spec:
            msg = (
                f"Unknown format code '{format_spec}' for object of type 'NumberVar'. It is only supported to use ',', '_', and '.f' for float numbers."
                "If possible, use computed variables instead: https://reflex.dev/docs/vars/computed-vars/"
            )
            raise VarValueError(msg)

        return super().__format__(format_spec)
Format the number.

        Args:
            format_spec: The format specifier.

        Returns:
            The formatted number.

        Raises:
            VarValueError: If the format specifier is not supported.
        
reflex/vars/number.py