code: def assert_array_equal(a, b, almost=False):
      if issparse(a):
          a = a.toarray()
      else:
          a = np.asarray(a)
      if issparse(b):
          b = b.toarray()
      else:
          b = np.asarray(b)
      if not almost:
          np.testing.assert_array_equal(a, b)
      else:
          np.testing.assert_almost_equal(a, b)
  
imports: import pickle
  import numpy
  import pytest
  import scipy.sparse
  from ...None import sparse
  from ..None import SparseNDArray, SparseVector, SparseMatrix
  from ..core import issparse
label_desc: Use image node_id 1 for calling a global function with example usage: assert_array_equal(a, b, almost) without return types