'Returns the saved state for a gui'

def get_gui_state(self, gui):

    try:
        state = mkdict(self.gui_state[gui.name()])
    except KeyError:
        state = self.gui_state[gui.name()] = {}
    return state
