def preprocess(
        self, payload: list[str | int | float]
    ) -> list[str | int | float] | list[int | None]:
        """
        Parameters:
            payload: the list of checked checkboxes' values
        Returns:
            Passes the list of checked checkboxes as a `list[str | int | float]` or their indices as a `list[int]` into the function, depending on `type`.
        """
        choice_values = [value for _, value in self.choices]
        for value in payload:
            if value not in choice_values:
                raise Error(
                    f"Value: {value!r} (type: {type(value)}) is not in the list of choices: {choice_values}"
                )
        if self.type == "value":
            return payload
        elif self.type == "index":
            return [
                choice_values.index(choice) if choice in choice_values else None
                for choice in payload
            ]
        else:
            raise ValueError(
                f"Unknown type: {self.type}. Please choose from: 'value', 'index'."
            )

        Parameters:
            payload: the list of checked checkboxes' values
        Returns:
            Passes the list of checked checkboxes as a `list[str | int | float]` or their indices as a `list[int]` into the function, depending on `type`.
        
gradio/components/checkboxgroup.py