code: def unload(self):
          
          # Remove the plugin menu item and icon
          if self.wizard:
              self.wizard.deleteLater()
          for myAction in self.actions:
              self.iface.removePluginMenu(self.tr('InaSAFE'), myAction)
              self.iface.removeToolBarIcon(myAction)
              self.iface.removeCustomActionForLayerType(myAction)
          self.iface.mainWindow().removeDockWidget(self.dock_widget)
          self.iface.mainWindow().removeToolBar(self.toolbar)
          self.dock_widget.setVisible(False)
          self.dock_widget.destroy()
          self.iface.currentLayerChanged.disconnect(self.layer_changed)
  
          # Unload QGIS expressions loaded by the plugin.
          for qgis_expression in list(qgis_expressions().keys()):
              QgsExpression.unregisterFunction(qgis_expression)
docs: GUI breakdown procedure (for QGIS plugin api).
  
          .. note:: Don't change the name of this method from unload!
  
          This method is called by QGIS and should be used to *remove*
          any graphical user interface elements that should appear in QGIS.