code: def frame_to_str(frame: Node):
      annotation_str = OPEN + escape_brackets(frame.label) + " "
      cur_index = 0
      for slot in sorted(
          frame.children, key=lambda slot: slot.span.start
      ):
          annotation_str += escape_brackets(
              get_substring_from_offsets(
                  frame.text, cur_index, slot.span.start
              )
          )
          annotation_str += (
              OPEN
              + escape_brackets(slot.label)
              + " "
              + escape_brackets(
                  get_substring_from_offsets(
                      frame.text, slot.span.start, slot.span.end
                  )
              )
              + " "
              + CLOSE
          )
          cur_index = slot.span.end
      annotation_str += (
          escape_brackets(
              get_substring_from_offsets(frame.text, cur_index, None)
          )
          + " "
          + CLOSE
      )
  
      return annotation_str
  
imports: from typing import Dict, List, Optional
  from pytext.common.constants import DatasetFieldName, Stage
  from pytext.data.data_structures.annotation import CLOSE, escape_brackets, OPEN
  from pytext.metrics.intent_slot_metrics import compute_all_metrics, FramePredictionPair, Node, Span
  from pytext.utils.data import byte_length, get_substring_from_offsets, merge_token_labels_to_slot, parse_slot_string
  from .channel import Channel, ConsoleChannel, FileChannel
  from .metric_reporter import MetricReporter
label_desc: Use image node_id 2 for calling a global function with example usage: frame_to_str(frame) and returns: annotation_str