code: def test_shade_rescale_discrete_levels_categorical(array_module):
      arr = array_module.array(
          [
              [[1, 2], [0, 1]],
              [[0, 0], [0, 0]],
              [[1, 0], [3, 0]],
              [[1, 0], [2, 1]],
          ],
          dtype="u4",
      )
      agg = xr.DataArray(
          data=arr,
          coords=dict(y=[0, 1, 2, 3], x=[0, 1], cat=["a", "b"]),
      )
      img = tf.shade(agg, how="eq_hist", rescale_discrete_levels=True)
  
      sol = np.array(
          [
              [0xFF845C70, 0x6FB87E37],
              [0x006A4C8D, 0x006A4C8D],
              [0x6F1C1AE4, 0xFF1C1AE4],
              [0x6F1C1AE4, 0xFF503BAA],
          ]
      )
      assert_eq_ndarray(img.data, sol)
  
imports: from __future__ import annotations
  from io import BytesIO
  import numpy
  import xarray
  import dask.array
  import PIL
  import pytest
  import datashader.transfer_functions
  from datashader.tests.test_pandas import assert_eq_ndarray, assert_eq_xr, assert_image_close
label_desc: Use image node_id 17 for calling a global function with example usage: test_shade_rescale_discrete_levels_categorical(array_module) without return types