code: def compute_frame_accuracies_by_depth(
      frame_pairs: Sequence[FramePredictionPair],
  ) -> FrameAccuraciesByDepth:
      """
      Given a list of predicted and gold intent frames, splits the predictions into
      buckets according to the depth of the gold trees, and computes frame accuracy for
      each bucket.
  
      Args:
          frame_pairs: List of predicted and gold intent frames.
  
      Returns:
          FrameAccuraciesByDepth, a map from depths to their corresponding frame
          accuracies.
      """
      frame_pairs_by_depth: Dict[
          int, List[FramePredictionPair]
      ] = defaultdict(list)
      for frame_pair in frame_pairs:
          depth = frame_pair.expected_frame.get_depth()
          frame_pairs_by_depth[depth].append(frame_pair)
      frame_accuracies_by_depth: FrameAccuraciesByDepth = {}
      for depth, pairs in frame_pairs_by_depth.items():
          frame_accuracies_by_depth[depth] = FrameAccuracy(
              len(pairs), compute_frame_accuracy(pairs)
          )
      return frame_accuracies_by_depth
  
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 10 for calling a global function with example usage: compute_frame_accuracies_by_depth(frame_pairs) and returns: frame_accuracies_by_depth