code: def _assert_image_data(image_data: Any) -> None:
      try:
          import numpy as np
  
          if not isinstance(image_data, np.ndarray):
              raise Exception(
                  "Invalid image_data: ndarray is expacted but was {}".format(
                      type(image_data)
                  )
              )
  
          if image_data.ndim not in (2, 3):
              raise Exception(
                  "Invalid image_data: 2d or 3d array is expacted but was {}-dimentional".format(
                      image_data.ndim
                  )
              )
      except ImportError:
          pass
  
file_path: lets-plot/python-package/lets_plot/bistro/im.py
imports: from typing import Any
  from lets_plot.plot.geom_imshow_ import geom_imshow
  from lets_plot.plot.plot import ggplot, GGBunch
  from lets_plot.plot.scale_position import scale_x_continuous, scale_y_continuous
  from lets_plot.plot.theme_ import theme
  from lets_plot.plot.util import is_ndarray
label_desc: Use image node_id 2 for calling a global function with example usage: _assert_image_data(image_data) without return types