code: def build_request(treebank):
      """
      treebank should be a list of pairs:  [gold, predictions]
        each predictions is a list of tuples (prediction, score, state)
        state is ignored and can be None
      Note that for now, only one tree is measured, but this may be extensible in the future
      Trees should be in the form of a Tree from parse_tree.py
      """
      request = EvaluateParserRequest()
      for raw_result in treebank:
          gold = raw_result.gold
          predictions = raw_result.predictions
          parse_result = request.treebank.add()
          parse_result.gold.CopyFrom(build_tree(gold, None))
          for pred in predictions:
              if isinstance(pred, tuple):
                  prediction, score = pred
              else:
                  prediction = pred
                  score = None
              try:
                  parse_result.predicted.append(
                      build_tree(prediction, score)
                  )
              except Exception as e:
                  raise RuntimeError(
                      "Unable to build parser request from tree {}".format(
                          pred
                      )
                  ) from e
  
      return request
  
file_path: stanza/stanza/server/parser_eval.py
imports: from collections import namedtuple
  import sys
  import stanza
  from stanza.protobuf import EvaluateParserRequest, EvaluateParserResponse
  from stanza.server.java_protobuf_requests import send_request, build_tree, JavaProtobufContext
  from stanza.models.constituency.tree_reader import read_treebank
label_desc: Use image node_id 1 for calling a global function with example usage: build_request(treebank) and returns: request