def _TestPyVariant(o, is_generated, val, checker=None):
    if is_generated:
        (vt, got) = o.GetVariantAndType(val)
    else:
        var_vt = VARIANT((pythoncom.VT_UI2 | pythoncom.VT_BYREF), 0)
        var_result = VARIANT((pythoncom.VT_VARIANT | pythoncom.VT_BYREF), 0)
        o.GetVariantAndType(val, var_vt, var_result)
        vt = var_vt.value
        got = var_result.value
    if (checker is not None):
        checker(got)
        return
    assert (vt == val.varianttype), (vt, val.varianttype)
    if (type(val.value) in (tuple, list)):
        check = [(v.value if isinstance(v, VARIANT) else v) for v in val.value]
        got = list(got)
    else:
        check = val.value
    assert (type(check) == type(got)), (type(check), type(got))
    assert (check == got), (check, got)
def _TestPyVariant(o, is_generated, val, checker=None):
    if is_generated:
        (vt, got) = o.GetVariantAndType(val)
    else:
        var_vt = VARIANT((pythoncom.VT_UI2 | pythoncom.VT_BYREF), 0)
        var_result = VARIANT((pythoncom.VT_VARIANT | pythoncom.VT_BYREF), 0)
        o.GetVariantAndType(val, var_vt, var_result)
        vt = var_vt.value
        got = var_result.value
    if (checker is not None):
        checker(got)
        return
    assert (vt == val.varianttype), (vt, val.varianttype)
    if (type(val.value) in (tuple, list)):
        check = [(v.value if isinstance(v, VARIANT) else v) for v in val.value]
        got = list(got)
    else:
        check = val.value
    assert (type(check) == type(got)), (type(check), type(got))
    assert (check == got), (check, got)