code: def build_tree(tree, score):
      """
      Builds a FlattenedParseTree from CoreNLP.proto
  
      Populates the value field from tree.label and iterates through the
      children via tree.children.  Should work on any tree structure
      which follows that layout
  
      The score will be added to the top node (if it is not None)
  
      Operates by recursively calling add_tree_nodes
      """
      proto_tree = FlattenedParseTree()
      add_tree_nodes(proto_tree, tree, score)
      return proto_tree
  
imports: from collections import deque
  import subprocess
  from stanza.models.common.utils import misc_to_space_after
  from stanza.models.constituency.parse_tree import Tree
  from stanza.protobuf import DependencyGraph, FlattenedParseTree
  from stanza.server.client import resolve_classpath
label_desc: Use image node_id 3 for calling a global function with example usage: build_tree(tree, score) and returns: proto_tree