code: def assert_equal(actual, desired, err_msg=""):
      """
      Asserts that two items are equal.
  
      """
      # Case #1: dictionary .....
      if isinstance(desired, dict):
          if not isinstance(actual, dict):
              raise AssertionError(repr(type(actual)))
          assert_equal(len(actual), len(desired), err_msg)
          for k, i in desired.items():
              if k not in actual:
                  raise AssertionError(f"{k} not in {actual}")
              assert_equal(
                  actual[k], desired[k], f"key={k!r}\n{err_msg}"
              )
          return
      # Case #2: lists .....
      if isinstance(desired, (list, tuple)) and isinstance(
          actual, (list, tuple)
      ):
          return _assert_equal_on_sequences(actual, desired, err_msg="")
      if not (
          isinstance(actual, ndarray) or isinstance(desired, ndarray)
      ):
          msg = build_err_msg(
              [actual, desired],
              err_msg,
          )
          if not desired == actual:
              raise AssertionError(msg)
          return
      # Case #4. arrays or equivalent
      if ((actual is masked) and not (desired is masked)) or (
          (desired is masked) and not (actual is masked)
      ):
          msg = build_err_msg(
              [actual, desired], err_msg, header="", names=("x", "y")
          )
          raise ValueError(msg)
      actual = np.asanyarray(actual)
      desired = np.asanyarray(desired)
      (actual_dtype, desired_dtype) = (actual.dtype, desired.dtype)
      if actual_dtype.char == "S" and desired_dtype.char == "S":
          return _assert_equal_on_sequences(
              actual.tolist(), desired.tolist(), err_msg=""
          )
      return assert_array_equal(actual, desired, err_msg)
  
imports: import operator
  import numpy
  from numpy import ndarray, float_
  import numpy.core.umath
  import numpy.testing
  from numpy.testing import assert_, assert_allclose, assert_array_almost_equal_nulp, assert_raises, build_err_msg
  from .core import mask_or, getmask, masked_array, nomask, masked, filled
  from unittest import TestCase
label_desc: Use image node_id 5 for calling a global function with example usage: assert_equal(actual, desired, err_msg) and returns: assert_array_equal, _assert_equal_on_sequences, _assert_equal_on_sequences