def validate_value_and_options(self, value, options):
        """Check whether value and options are valid.

        Parameters
        ==========
        value, options
            same as defined in the __init__() method's
            docstring.
        """
        ### raise an error if the value isn't within the
        ### available options

        if value not in options:
            raise ValueError("'value' must be listed in 'options'")

        ### raise type error if values aren't python
        ### literals

        if any(not isliteral(item) for item in options):

            raise TypeError("each item in 'options' must be a" " python literal")

        ### raise value error if any value is the same/equal
        ### as any other existing value

        if any(a is b or a == b for a, b in combinations(options, 2)):

            raise ValueError(
                "'options' can't have items which are"
                " identical or equal to one another"
            )

        ### if a maximum width was specified, raise a value
        ### error if sum of the options' widths are not
        ### within that maximum width

        if self.max_width:

            ## calculate sum of options' widths

            total_width = sum(
                get_text_size(
                    str(option),
                    font_height=self.font_height,
                    font_path=self.font_path,
                )[0]
                + 6
                for option in options
            )

            ## compare it with the maximum width allowed

            if total_width > self.max_width:

                raise ValueError(
                    "sum of option width's must not"
                    " surpass given 'max_width' when"
                    " max_width > 0"
                )
Check whether value and options are valid.

        Parameters
        ==========
        value, options
            same as defined in the __init__() method's
            docstring.
        
nodezator/widget/optiontray/main.py