<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sizeHint(self, option, index):
 """Return the appropriate amount for the size of the widget The widget will always be expanded to at least the size of the viewport. :param option: the options for painting :type option: :class:`QtGui.QStyleOptionViewItem` :param index: the index to paint :type index: :class:`QtCore.QModelIndex` :returns: None :rtype: None :raises: None """

        if self._widget is None:
            return super(WidgetDelegate, self).sizeHint(option, index)

        self.set_widget_index(index)
        self._widget.resize(option.rect.size())
        sh = self._widget.sizeHint()
        return sh