def METHOD_NAME(a, b, bidx=None):
    if isinstance(a, OrderedDict):
        for key in a:
            if not TestSpaces.METHOD_NAME(a[key], b[key], bidx):
                return False
        return True
    elif isinstance(a, Tuple):
        for it in range(len(a)):
            if not TestSpaces.METHOD_NAME(a[it], b[it], bidx):
                return False
        return True
    else:
        # np.array_equal also works for torch tensors and scalars
        if bidx is None:
            return np.array_equal(a, b)
        else:
            return np.array_equal(a, b[bidx])