code: def assert_image(
      resp: pb.Response | pb.Part,
      assert_kind: str,
      im_file: str | ext.NpNDArray,
  ) -> bool:
      fio = io.BytesIO(resp.file.content)
      fio.name = "test.bmp"
      img = PILImage.open(fio)
      a1 = np.array(img)
      if LazyType["ext.NpNDArray"]("numpy.ndarray").isinstance(im_file):
          a2 = PILImage.fromarray(im_file)
      else:
          assert isinstance(im_file, str)
          a2 = PILImage.open(im_file)
      try:
          assert resp.file.kind == assert_kind
          np.testing.assert_array_almost_equal(a1, np.array(a2))
          return True
      except AssertionError:
          traceback.print_exc()
          return False
  
imports: from __future__ import annotations
  import io
  import os
  import random
  import sys
  import traceback
  import typing
  from functools import partial
  import pytest
  from bentoml._internal.types import LazyType
  from bentoml._internal.utils import LazyLoader
  from bentoml.grpc.utils import import_generated_stubs
  from bentoml.grpc.utils import import_grpc
  from bentoml.testing.grpc import async_client_call
  from bentoml.testing.grpc import create_channel
  from bentoml.testing.grpc import randomize_pb_ndarray
label_desc: Use image node_id 3 for calling a global function with example usage: assert_image(resp, assert_kind, im_file) and returns: True, False