code: def test_open(model=None):
      if model is None:
          model = SimpleModel()
      state = build_initial_state(model)[0]
  
      shift = parse_transitions.Shift()
      state = shift.apply(state, model)
      state = shift.apply(state, model)
      assert state.num_opens == 0
  
      open_transition = parse_transitions.OpenConstituent("VP")
      assert open_transition.is_legal(state, model)
      state = open_transition.apply(state, model)
      assert open_transition.is_legal(state, model)
      assert state.num_opens == 1
  
      # check that it is illegal if there are too many opens already
      for i in range(20):
          state = open_transition.apply(state, model)
      assert not open_transition.is_legal(state, model)
      assert state.num_opens == 21
  
      # check that it is illegal if the state is out of words
      state = build_initial_state(model)[0]
      state = shift.apply(state, model)
      state = shift.apply(state, model)
      state = shift.apply(state, model)
      assert not open_transition.is_legal(state, model)
  
imports: import pytest
  from stanza.models.constituency import parse_transitions
  from stanza.models.constituency.base_model import SimpleModel, UNARY_LIMIT
  from stanza.models.constituency.parse_transitions import TransitionScheme, Shift, CloseConstituent, OpenConstituent
  from stanza.tests import *
label_desc: Use image node_id 7 for calling a global function with example usage: test_open(model) without return types