code: def almost_eq(a, b, max_diff=1e-7, ignore_type=True, pad=0.):
    
    if not (ignore_type or type(a) == type(b)):
      return False
    is_it_a = isinstance(a, Iterable)
    is_it_b = isinstance(b, Iterable)
    if is_it_a != is_it_b:
      return False
    if is_it_a:
      return all(almost_eq.diff(ai, bi, max_diff, ignore_type)
                 for ai, bi in xzip_longest(a, b, fillvalue=pad))
    return abs(a - b) <= max_diff
docs: Almost equal, based on the :math:`|a - b|` value.
  
    Alternative to "a == b" for float numbers and iterables with float numbers.
    See almost_eq for more information.
  
    This version based on the non-normalized absolute diff, similar to what
    unittest does with its assertAlmostEquals. If a and b sizes differ, at least
    one will be padded with the pad input value to keep going with the
    comparison.
  
    Note
    ----
    Be careful with endless generators!