code: def _filter_library_state(self, items):
          if not items:
              return items
          top_most_item = items[0]
          top_most_state_v = top_most_item if isinstance(top_most_item, StateView) else top_most_item.parent
          state = top_most_state_v.model.state
          global_gui_config = gui_helper_state_machine.global_gui_config
          if global_gui_config.get_config_value('STATE_SELECTION_INSIDE_LIBRARY_STATE_ENABLED'):
              if state.is_root_state_of_library:
                  new_topmost_item = self.view.canvas.get_view_for_core_element(state.parent)
                  return self.dismiss_upper_items(items, new_topmost_item)
              return items
          else:
              library_root_state = state.get_uppermost_library_root_state()
              if library_root_state:
                  library_state = library_root_state.parent
                  library_state_v = self.view.canvas.get_view_for_core_element(library_state)
                  return self.dismiss_upper_items(items, library_state_v)
              return items