<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def connect_widget(self, wid, getter=None, setter=None, signal=None, arg=None, update=True, flavour=None):
 """ Finish set-up by connecting the widget. The model was already specified in the constructor. *wid* is a widget instance. *getter* is a callable. It is passed *wid* and must return its current value. *setter* is a callable. It is passed *wid* and the current value of the model property and must update the widget. *signal* is a string naming the signal to connect to on *wid*. When it is emitted we update the model. *getter*, *setter* and *signal* are optional. Missing values are guessed from *wid* using :meth:`gtkmvc3.adapters.default.search_adapter_info`. If nothing is found this raises :exc:`TypeError`. *arg* is an optional value passed to the handler for *signal*. This doesn't do anything unless a subclass overrides the handler. *update* denotes whether to update the widget from the model immediately. Otherwise the widget stays unchanged until the first notification. *flavour* can be used to select special behaviours about the adaptation when twice or more possibilities are possibly handled for the same widget type. See adapters.default for further information. """


        if wid in self._wid_info:
            raise ValueError("Widget " + str(wid) + " was already connected")

        wid_type = None

        if None in (getter, setter, signal):
            w = search_adapter_info(wid, flavour)
            if getter is None:
                getter = w[GETTER]
            if setter is None:
                setter = w[SETTER]
                wid_type = w[WIDTYPE]

            if signal is None:
                signal = w[SIGNAL]

        # saves information about the widget
        self._wid_info[wid] = (getter, setter, wid_type)

        # connects the widget
        if signal:
            if arg:
                wid.connect(signal, self._on_wid_changed, arg)
            else:
                wid.connect(signal, self._on_wid_changed)

        self._wid = wid

        # updates the widget:
        if update:
            self.update_widget()