code: def save_tabs_when_changed(func):
      
  
      def wrapper(*args, **kwargs):
          func(*args, **kwargs)
          log.debug("mom, I've been called: %s %s", func.__name__, func)
  
          # Find me the Guake!
          clsname = args[0].__class__.__name__
          g = None
          if clsname == 'Guake':
              g = args[0]
          elif getattr(args[0], 'get_guake', None):
              g = args[0].get_guake()
          elif getattr(args[0], 'get_notebook', None):
              g = args[0].get_notebook().guake
          elif getattr(args[0], 'guake', None):
              g = args[0].guake
          elif getattr(args[0], 'notebook', None):
              g = args[0].notebook.guake
  
          # Tada!
          if g and g.settings.general.get_boolean('save-tabs-when-changed'):
              g.save_tabs()
  
      return wrapper
docs: Decorator for save-tabs-when-changed