<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_state(container_state_m, state_type):
 """Add a state to a container state Adds a state of type state_type to the given container_state :param rafcon.gui.models.container_state.ContainerState container_state_m: A model of a container state to add the new state to :param rafcon.core.enums.StateType state_type: The type of state that should be added :return: True if successful, False else """

    if container_state_m is None:
        logger.error("Cannot add a state without a parent.")
        return False

    if not isinstance(container_state_m, StateModel) or \
            (isinstance(container_state_m, StateModel) and not isinstance(container_state_m, ContainerStateModel)):
        logger.error("Parent state must be a container, for example a Hierarchy State." + str(container_state_m))
        return False

    state_class = state_type_to_state_class_dict.get(state_type, None)

    if state_class is None:
        logger.error("Cannot create state of type {0}".format(state_type))
        return False

    new_state = state_class()
    from rafcon.gui.models.abstract_state import get_state_model_class_for_state
    new_state_m = get_state_model_class_for_state(new_state)(new_state)
    gui_helper_meta_data.put_default_meta_on_state_m(new_state_m, container_state_m)
    container_state_m.expected_future_models.add(new_state_m)
    container_state_m.state.add_state(new_state)
    return True