code: def advance_past_constituents(gold_sequence, cur_index):
      """
      Advance cur_index through gold_sequence until we have seen 1 more Close than Open
  
      The index returned is the index of the Close which occurred after all the stuff
      """
      count = 0
      while cur_index < len(gold_sequence):
          if isinstance(gold_sequence[cur_index], OpenConstituent):
              count = count + 1
          elif isinstance(gold_sequence[cur_index], CloseConstituent):
              count = count - 1
              if count == -1:
                  return cur_index
          cur_index = cur_index + 1
      return None
  
imports: from enum import Enum, auto
  from stanza.models.constituency.dynamic_oracle import DynamicOracle
  from stanza.models.constituency.parse_transitions import Shift, OpenConstituent, CloseConstituent
label_desc: Use image node_id 3 for calling a global function with example usage: advance_past_constituents(gold_sequence, cur_index) and returns: None, cur_index