code: def do_test(request):
      test_message = test_messages_proto3_pb2.TestAllTypes()
      response = conformance_pb2.ConformanceResponse()
      test_message = test_messages_proto3_pb2.TestAllTypes()
  
      try:
          if request.WhichOneof("payload") == "protobuf_payload":
              try:
                  test_message.ParseFromString(request.protobuf_payload)
              except message.DecodeError as e:
                  response.parse_error = str(e)
                  return response
  
          elif request.WhichOneof("payload") == "json_payload":
              try:
                  json_format.Parse(request.json_payload, test_message)
              except Exception as e:
                  response.parse_error = str(e)
                  return response
  
          else:
              raise ProtocolError("Request didn't have payload.")
  
          if (
              request.requested_output_format
              == conformance_pb2.UNSPECIFIED
          ):
              raise ProtocolError("Unspecified output format")
  
          elif (
              request.requested_output_format
              == conformance_pb2.PROTOBUF
          ):
              response.protobuf_payload = (
                  test_message.SerializeToString()
              )
  
          elif request.requested_output_format == conformance_pb2.JSON:
              try:
                  response.json_payload = json_format.MessageToJson(
                      test_message
                  )
              except Exception as e:
                  response.serialize_error = str(e)
                  return response
  
      except Exception as e:
          response.runtime_error = str(e)
  
      return response
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/deps/protobuf/conformance/conformance_python.py
imports: import struct
  import sys
  import os
  from google.protobuf import json_format
  from google.protobuf import message
  from google.protobuf import test_messages_proto3_pb2
  import conformance_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: do_test(request) and returns: response, response, response, response