code: def get_only_selected_choices(self, value):
          
          schoices = self.choices
          selected_choices = set([force_text(v) for v in value if v])
          if isinstance(schoices, ModelChoiceIterator):
              schoices.queryset = schoices.queryset.filter(pk__in=selected_choices)
          else:
              schoices = [e for e in schoices if force_text(e) in selected_choices]
          return schoices
docs: Return a list of optgroups for this widget.