code: def build_request(trees, operations):
      """
      Build the TsurgeonRequest object
  
      trees: a list of trees
      operations: a list of (tregex, tsurgeon, tsurgeon, ...)
      """
      if isinstance(trees, Tree):
          trees = (trees,)
  
      request = TsurgeonRequest()
      for tree in trees:
          request.trees.append(build_tree(tree, 0.0))
      if all(isinstance(x, str) for x in operations):
          operations = (operations,)
      for operation in operations:
          if len(operation) == 1:
              raise ValueError(
                  "Expected [tregex, tsurgeon, ...] but just got a tregex"
              )
          operation_request = request.operations.add()
          operation_request.tregex = operation[0]
          for tsurgeon in operation[1:]:
              operation_request.tsurgeon.append(tsurgeon)
      return request
  
file_path: stanza/stanza/server/tsurgeon.py
imports: from stanza.models.constituency import tree_reader
  from stanza.models.constituency.parse_tree import Tree
  from stanza.protobuf import TsurgeonRequest, TsurgeonResponse
  from stanza.server.java_protobuf_requests import send_request, build_tree, from_tree, JavaProtobufContext
label_desc: Use image node_id 2 for calling a global function with example usage: build_request(trees, operations) and returns: request