def create_state_model_for_state(new_state, meta, state_element_models):
    """Create a new state model with the defined properties

    A state model is created for a state of the type of new_state. All child models in state_element_models (
    model list for port, connections and states) are added to the new model.

    :param StateModel new_state: The new state object with the correct type
    :param Vividict meta: Meta data for the state model
    :param list state_element_models: All state element and child state models of the original state model
    :return: New state model for new_state with all childs of state_element_models
    """
    from rafcon.gui.models.abstract_state import get_state_model_class_for_state
    state_m_class = get_state_model_class_for_state(new_state)
    new_state_m = state_m_class(new_state, meta=meta, load_meta_data=False, expected_future_models=state_element_models)
    error_msg = "New state has not re-used all handed expected future models."
    check_expected_future_model_list_is_empty(new_state_m, msg=error_msg)

    return new_state_m
Create a new state model with the defined properties

    A state model is created for a state of the type of new_state. All child models in state_element_models (
    model list for port, connections and states) are added to the new model.

    :param StateModel new_state: The new state object with the correct type
    :param Vividict meta: Meta data for the state model
    :param list state_element_models: All state element and child state models of the original state model
    :return: New state model for new_state with all childs of state_element_models