<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def change_state_type(self, state, new_state_class):
 """ Changes the type of the state to another type :param state: the state to be changed :param new_state_class: the new type of the state :return: the new state having the new state type :rtype: :py:class:`rafcon.core.states.state.State` :raises exceptions.ValueError: if the state does not exist in the container state """

        from rafcon.gui.helpers.state import create_new_state_from_state_with_type

        state_id = state.state_id

        if state_id not in self.states:
            raise ValueError("State '{0}' with id '{1}' does not exist".format(state.name, state_id))

        new_state = create_new_state_from_state_with_type(state, new_state_class)
        new_state.parent = self

        assert new_state.state_id == state_id

        self.states[state_id] = new_state

        return new_state