code: def check_equality(expected, actual) -> bool:
      if isinstance(expected, set):
          # Sets are serialized as lists — we check if they have the same elements
          return equals_list(
              sorted(expected, key=hash), sorted(actual, key=hash)
          )
      elif np.issubdtype(type(expected), np.integer):
          # Integer types are expected to be equal exactly
          return np.equal(expected, actual)
      elif np.issubdtype(type(expected), np.inexact):
          # Floating point types are expected to be equal up a certain digit, as specified in np.isclose
          return np.allclose(expected, actual)
      else:
          return equals(expected, actual)
  
imports: from functools import partial
  from operator import add
  from pathlib import Path
  from typing import NamedTuple
  import numpy
  import pandas
  import pytest
  from gluonts.core.component import equals, equals_list
  from gluonts.core import serde
label_desc: Use image node_id 1 for calling a global function with example usage: check_equality(expected, actual) and returns: equals_list, np, np, equals