def METHOD_NAME(widget):
    """
    Create a Qt hidden signal to the widget as sigHidden attribute
    :type widget: Qt.QWidget
    """
    if hasattr(widget, "sigHidden"):
        if isinstance(widget.sigHidden, SimulatedSignal):
            return
        raise Exception("Attribute sigClose already exists and is not a Qt signal")
    def hideEvent(self, event):
        widget.sigHidden.emit()
        self._createHideSignal_oldHideEvent(event)
    widget.sigHidden = SimulatedSignal()
    widget._createHideSignal_oldHideEvent = widget.hideEvent
    widget.hideEvent = types.MethodType(hideEvent, widget)