code: def fix_close_shift_nested(
      gold_transition,
      pred_transition,
      gold_sequence,
      gold_index,
      root_labels,
  ):
      """
      Fix a Close X..Open X..Shift pattern where both the Close and Open were skipped.
      """
      if not isinstance(gold_transition, CloseConstituent):
          return None
      if not isinstance(pred_transition, Shift):
          return None
  
      if len(gold_sequence) < gold_index + 3:
          return None
      # check that the next operation was to open the same constituent
      # we just closed
      prev_open_index = find_previous_open(gold_sequence, gold_index)
      if prev_open_index is None:
          return None
      prev_open = gold_sequence[prev_open_index]
      if gold_sequence[gold_index + 1] != prev_open:
          return None
  
      # TODO: here could skip unary transitions
      # could also look for unary transitions of the same type after a
      # different constituent was built (more complicated and rare)
      if not isinstance(gold_sequence[gold_index + 2], Shift):
          return None
  
      return (
          gold_sequence[:gold_index] + gold_sequence[gold_index + 2 :]
      )
  
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 13 for calling a global function with example usage: fix_close_shift_nested(gold_transition, pred_transition, gold_sequence, gold_index, root_labels) and returns: unknown, None, None, None, None, None, None