code: def ExpectAllFieldsAndExtensionsInOrder(serialized):
      """Ensures that serialized is the serialization we expect for a message
      filled with SetAllFieldsAndExtensions().  (Specifically, ensures that the
      serialization is in canonical, tag-number order).
      """
      my_extension_int = unittest_pb2.my_extension_int
      my_extension_string = unittest_pb2.my_extension_string
      expected_strings = []
      message = unittest_pb2.TestFieldOrderings()
      message.my_int = 1  # Field 1.
      expected_strings.append(message.SerializeToString())
      message.Clear()
      message.Extensions[my_extension_int] = 23  # Field 5.
      expected_strings.append(message.SerializeToString())
      message.Clear()
      message.my_string = "foo"  # Field 11.
      expected_strings.append(message.SerializeToString())
      message.Clear()
      message.Extensions[my_extension_string] = "bar"  # Field 50.
      expected_strings.append(message.SerializeToString())
      message.Clear()
      message.my_float = 1.0
      expected_strings.append(message.SerializeToString())
      message.Clear()
      expected = "".join(expected_strings)
  
      if expected != serialized:
          raise ValueError(
              "Expected %r, found %r" % (expected, serialized)
          )
  
file_path: coremltools/deps/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/test_util.py
imports: import os.path
  from google.protobuf import unittest_import_pb2
  from google.protobuf import unittest_pb2
label_desc: Use image node_id 5 for calling a global function with example usage: ExpectAllFieldsAndExtensionsInOrder(serialized) without return types