code: def get_phrases_by_tree(tree):
      phrases = []
      if tree is None:
          return phrases
      if tree.is_leaf():
          pair = (tree.word, int(tree.label))
          phrases.append(pair)
          return phrases
      left_child_phrases = get_phrases_by_tree(tree.subtrees[0])
      right_child_phrases = get_phrases_by_tree(tree.subtrees[1])
      phrases.extend(left_child_phrases)
      phrases.extend(right_child_phrases)
      sentence = get_sentence_by_tree(tree)
      pair = (sentence, int(tree.label))
      phrases.append(pair)
      return phrases
  
imports: import logging
  import os
  import pickle
  from collections import Counter
  import numpy
  import torch
  from torch.utils import data
label_desc: Use image node_id 5 for calling a global function with example usage: get_phrases_by_tree(tree) and returns: phrases, phrases, phrases