code: def assert_proto_equals(
      self,
      a,
      b,
      check_initialized=True,
      normalize_numbers=True,
      msg=None,
  ):
      """assert_proto_equals() is useful for unit tests.
  
      It produces much more helpful output than assertEqual() for proto2 messages.
      Fails with a useful error if a and b aren't equal. Comparison of repeated
      fields matches the semantics of unittest.TestCase.assertEqual(), ie order and
      extra duplicates fields matter.
  
      This is a fork of https://github.com/tensorflow/tensorflow/blob/
      master/tensorflow/python/util/protobuf/compare.py#L73. We use slightly
      different rounding cutoffs to support Mac usage.
  
      Args:
        self: absltest.testing.parameterized.TestCase
        a: proto2 PB instance, or text string representing one.
        b: proto2 PB instance -- message.Message or subclass thereof.
        check_initialized: boolean, whether to fail if either a or b isn't
          initialized.
        normalize_numbers: boolean, whether to normalize types and precision of
          numbers before comparison.
        msg: if specified, is used as the error message on failure.
      """
      pool = descriptor_pool.Default()
      if isinstance(a, six.string_types):
          a = text_format.Parse(a, b.__class__(), descriptor_pool=pool)
  
      for pb in a, b:
          if check_initialized:
              errors = pb.FindInitializationErrors()
              if errors:
                  self.fail(
                      "Initialization errors: %s\n%s" % (errors, pb)
                  )
          if normalize_numbers:
              _normalize_number_fields(pb)
  
      a_str = text_format.MessageToString(a, descriptor_pool=pool)
      b_str = text_format.MessageToString(b, descriptor_pool=pool)
  
      # Some Python versions would perform regular diff instead of multi-line
      # diff if string is longer than 2**16. We substitute this behavior
      # with a call to unified_diff instead to have easier-to-read diffs.
      # For context, see: https://bugs.python.org/issue11763.
      if len(a_str) < 2**16 and len(b_str) < 2**16:
          self.assertMultiLineEqual(a_str, b_str, msg=msg)
      else:
          diff = "".join(
              difflib.unified_diff(
                  a_str.splitlines(True), b_str.splitlines(True)
              )
          )
          if diff:
              self.fail("%s :\n%s" % (msg, diff))
  
file_path: mediapipe/mediapipe/tasks/python/test/test_utils.py
imports: import difflib
  import os
  from absl import flags
  import six
  from google.protobuf import descriptor
  from google.protobuf import descriptor_pool
  from google.protobuf import text_format
  from mediapipe.python._framework_bindings import image
  from mediapipe.python._framework_bindings import image_frame
label_desc: Use image node_id 4 for calling a global function with example usage: assert_proto_equals(a, b, check_initialized, normalize_numbers, msg) without return types