code: def assert_deep_almost_equal(testcase, result, actual, places=4):
      """Checks if provided inputs are almost equal, recurses on dicts values."""
      if isinstance(result, (int, float)):
          testcase.assertAlmostEqual(result, actual, places=places)
      elif isinstance(result, (list)):
          if all(isinstance(n, (int, float)) for n in result):
              rtol = 10 ** (-1 * places)
              npt.assert_allclose(result, actual, rtol=rtol, atol=1e-4)
          elif all(isinstance(n, dict) for n in result):
              for i in range(len(result)):
                  assert_deep_almost_equal(
                      testcase, result[i], actual[i]
                  )
      elif isinstance(result, dict):
          if set(result.keys()) != set(actual.keys()):
              testcase.fail("results and actual have different keys")
          for key in result:
              assert_deep_almost_equal(
                  testcase, result[key], actual[key]
              )
  
imports: from collections.abc import Iterable, Iterator
  from lit_nlp.api import model
  from lit_nlp.api import types
  import numpy
  import numpy.testing
label_desc: Use image node_id 2 for calling a global function with example usage: assert_deep_almost_equal(testcase, result, actual, places) without return types