<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_state_actions(self, state, **kwargs):
 """ A combination of StopActionGenerator and RemoveActionGenerator - stops and removes containers where appropriate. :param state: Configuration state. :type state: dockermap.map.state.ConfigState :param kwargs: Additional keyword arguments. :return: Actions on the client, map, and configurations. :rtype: list[dockermap.map.action.ItemAction] """

        config_type = state.config_id.config_type
        if config_type == ItemType.NETWORK:
            if state.base_state == State.PRESENT:
                connected_containers = state.extra_data.get('containers')
                if connected_containers:
                    cc_names = [c.get('Name', c['Id']) for c in connected_containers]
                    actions = [ItemAction(state, NetworkUtilAction.DISCONNECT_ALL,
                                          extra_data={'containers': cc_names})]
                else:
                    actions = []
                actions.append(ItemAction(state, Action.REMOVE, extra_data=kwargs))
                return actions
        elif config_type == ItemType.VOLUME and self.remove_attached:
            return [ItemAction(state, Action.REMOVE)]
        elif config_type == ItemType.CONTAINER:
            if self.remove_persistent or not state.state_flags & StateFlags.PERSISTENT:
                if state.base_state == State.RUNNING or state.state_flags & StateFlags.RESTARTING:
                    return [ItemAction(state, DerivedAction.SHUTDOWN_CONTAINER)]
                elif state.base_state == State.PRESENT:
                    return [ItemAction(state, Action.REMOVE)]
            elif state.base_state == State.RUNNING or state.state_flags & StateFlags.RESTARTING:
                return [ItemAction(state, Action.REMOVE)]