code: def assert_ndarray(
      resp: pb.Response,
      assert_shape: list[int],
      assert_dtype: pb.NDArray.DType.ValueType,
  ) -> bool:
      # Hide traceback from pytest
      __tracebackhide__ = True  # pylint: disable=unused-variable
  
      dtype = resp.ndarray.dtype
      try:
          assert resp.ndarray.shape == assert_shape
          assert dtype == assert_dtype
          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 1 for calling a global function with example usage: assert_ndarray(resp, assert_shape, assert_dtype) and returns: True, False