def METHOD_NAME(left, right):
    assert type(left) == type(right)
    for field in fields(left):
        left_attr = getattr(left, field.name)
        right_attr = getattr(right, field.name)
        if isinstance(left_attr, list):
            assert len(left_attr) == len(right_attr)
            for sub_left, sub_right in zip(left_attr, right_attr):
                METHOD_NAME(sub_left, sub_right)
        else:
            assert left_attr == right_attr