code: def compute_percent_trees_wrong_label(
      frame_pairs: Sequence[FramePredictionPair],
  ) -> float:
      """
      Computes percent of trees with incorrect intent (IN) or slot (SL) labels given a list
      of predicted and gold intent frames.
  
      Args:
          frame_pairs: List of predicted and gold intent frames.
  
      Returns:
          Percent of trees with incorrect labels. These include valid predicted trees of
          correct strucure but incorrect IN/SL labels.
      """
      num_incorrect = 0
      num_samples = len(frame_pairs)
      for predicted_frame, expected_frame in frame_pairs:
          # For trees with incorrect IN/SL labels,
          # 1. tree is valid
          # 2. structure is correct
          # 3. there is at lease 1 incorect label
          num_incorrect += int(
              predicted_frame.label != INVALID_TREE_INTENT
              and _check_node(
                  predicted_frame, expected_frame, check_label=False
              )
              and not _check_node(
                  predicted_frame, expected_frame, check_label=True
              )
          )
      return safe_division(num_incorrect, num_samples)
  
imports: from collections import Counter, defaultdict
  from copy import deepcopy
  from typing import AbstractSet, Any, Callable, Counter, Dict, List, NamedTuple, Optional, Sequence, Tuple
  from pytext.data.data_structures.annotation import INVALID_TREE_INTENT
  from pytext.data.data_structures.node import Node, Span
  from .None import AllConfusions, Confusions, PerLabelConfusions, PRF1Metrics, PRF1Scores, safe_division
label_desc: Use image node_id 12 for calling a global function with example usage: compute_percent_trees_wrong_label(frame_pairs) and returns: safe_division