def validate_value(self, value, available_items):
        """Check whether value is of allowed type."""
        if not isinstance(value, (list, tuple)):

            raise TypeError("'value' must be of type 'list'" " or 'tuple'")

        if not isinstance(available_items, set):

            raise TypeError("'available_items' must be of type 'set'")

        if len(value) and not set(value).issubset(available_items):

            raise ValueError(
                "if 'value' isn't empty, items must be" " a subset of available items"
            )

        if len(available_items) == 0:

            raise ValueError("'available_items' must not be empty")

        item_types_set = {
            type(item) for obj in (value, available_items) for item in obj
        }

        if not any(
            item_types_set == set(combination)
            for combination in ALLOWED_ITEM_TYPE_COMBINATIONS
        ):

            raise TypeError(
                "items must either all be instances of 'str'"
                " type or any combination of 'int' and 'float'"
                " instances"
            )
Check whether value is of allowed type.
nodezator/widget/sortingbutton.py