def scale_library_content(library_state_m, gaphas_editor=True):
    """Scales the meta data of the content of a LibraryState
    
    The contents of the `LibraryStateModel` `library_state_m` (i.e., the `state_copy` and all it children/state 
    elements) to fit the current size of the `LibraryStateModel`.
    
    :param LibraryStateModel library_state_m: The library who's content is to be resized 
    :param bool gaphas_editor: Whether to use the meta data for the GraphicalEditor using gaphas (default: True) 
    """
    assert isinstance(library_state_m, LibraryStateModel)
    # For library states with an ExecutionState as state_copy, scaling does not make sense
    if not isinstance(library_state_m.state_copy, ContainerStateModel):
        return

    # use same size for state copy and put rel_pos to zero
    library_meta = library_state_m.get_meta_data_editor(gaphas_editor)
    state_copy_meta = library_state_m.state_copy.set_meta_data_editor('size', library_meta['size'], gaphas_editor)
    library_state_m.state_copy.set_meta_data_editor('rel_pos', (0., 0.), from_gaphas=gaphas_editor)

    # work around that gaphas draws in state_copy coordinates (which is not shown) -> reduce state copy size
    if gaphas_editor:
        library_state_margin = cal_margin(state_copy_meta['size'])
        state_copy_size = subtract_pos(state_copy_meta['size'], (2*library_state_margin, 2*library_state_margin))
        library_state_m.state_copy.set_meta_data_editor('size', state_copy_size, gaphas_editor)

    # if meta data has empty fields put default data on state meta data
    if model_has_empty_meta(library_state_m.state_copy) and \
            not put_default_meta_data_on_state_m_recursively(library_state_m.state_copy, library_state_m,
                                                             only_child_states=True):
        return

    # prepare resize by collecting all state elements in the models_dict
    # do resize in respect to state copy
    # (opengl same size as library state and in case of gaphas reduced by library state margin)
    models_dict = {'state': library_state_m.state_copy}
    for state_element_key in library_state_m.state_copy.state.state_element_attrs:
        state_element_list = getattr(library_state_m.state_copy, state_element_key)
        # Some models are hold in a gtkmvc3.support.wrappers.ObsListWrapper, not a list
        if hasattr(state_element_list, 'keys'):
            state_element_list = state_element_list.values()
        models_dict[state_element_key] = {elem.core_element.core_element_id: elem for elem in state_element_list}

    # perform final resize
    resize_factor = (1., 1.)
    try:
        if not models_dict['states'] and (not models_dict['scoped_variables'] or gaphas_editor):
            logger.info("Skip scaling for empty root state {0}.".format(library_state_m.state))
        else:
            resize_factor = scale_meta_data_according_state(models_dict, fill_up=True)
    except:
        logger.exception("Scale library content of {0} cause a problem.".format(library_state_m.state))
    finally:
        resize_income_of_state_m(library_state_m.state_copy, resize_factor, gaphas_editor)
Scales the meta data of the content of a LibraryState
    
    The contents of the `LibraryStateModel` `library_state_m` (i.e., the `state_copy` and all it children/state 
    elements) to fit the current size of the `LibraryStateModel`.
    
    :param LibraryStateModel library_state_m: The library who's content is to be resized 
    :param bool gaphas_editor: Whether to use the meta data for the GraphicalEditor using gaphas (default: True)