<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def open_state_machine(path=None, recent_opened_notification=False):
 """ Open a state machine from respective file system path :param str path: file system path to the state machine :param bool recent_opened_notification: flags that indicates that this call also should update recently open :rtype rafcon.core.state_machine.StateMachine :return: opened state machine """

    start_time = time.time()
    if path is None:
        if interface.open_folder_func is None:
            logger.error("No function defined for opening a folder")
            return
        load_path = interface.open_folder_func("Please choose the folder of the state machine")
        if load_path is None:
            return
    else:
        load_path = path

    if state_machine_manager.is_state_machine_open(load_path):
        logger.info("State machine already open. Select state machine instance from path {0}.".format(load_path))
        sm = state_machine_manager.get_open_state_machine_of_file_system_path(load_path)
        gui_helper_state.gui_singletons.state_machine_manager_model.selected_state_machine_id = sm.state_machine_id
        return state_machine_manager.get_open_state_machine_of_file_system_path(load_path)

    state_machine = None
    try:
        state_machine = storage.load_state_machine_from_path(load_path)
        state_machine_manager.add_state_machine(state_machine)
        if recent_opened_notification:
            global_runtime_config.update_recently_opened_state_machines_with(state_machine)
        duration = time.time() - start_time
        stat = state_machine.root_state.get_states_statistics(0)
        logger.info("It took {0:.2}s to load {1} states with {2} hierarchy levels.".format(duration, stat[0], stat[1]))
    except (AttributeError, ValueError, IOError) as e:
        logger.error('Error while trying to open state machine: {0}'.format(e))

    return state_machine