class_docstr: Selection that is guaranteed to have a value selected.
class_docstr_tok: ["Selection","that","is","guaranteed","to","have","a","value","selected","."]
code: def _validate_index(self, proposal):
      if 0 <= proposal.value < len(self._options_labels):
          return proposal.value
      else:
          raise TraitError("Invalid selection: index out of bounds")
  
imports: from collections.abc import Iterable, Mapping
  from itertools import chain
  from .widget_description import DescriptionWidget, DescriptionStyle
  from .valuewidget import ValueWidget
  from .widget_core import CoreWidget
  from .widget_style import Style
  from .trait_types import InstanceDict, TypedTuple
  from .widget import register, widget_serialization
  from .widget_int import SliderStyle
  from .docutils import doc_subst
  from traitlets import Unicode, Bool, Int, Any, Dict, TraitError, CaselessStrEnum, Tuple, Union, observe, validate
label_desc: Use image node_id 3 for calling the _SelectionNonempty obj's underlying member method code with example usage: obj._validate_index(proposal) and returns: proposal