code: def check_widget(w, **d):
      """Check a single widget against a dict"""
      for attr, expected in d.items():
          if attr == "cls":
              assert w.__class__ is expected
          else:
              value = getattr(w, attr)
              assert value == expected, "%s.%s = %r != %r" % (
                  w.__class__.__name__,
                  attr,
                  value,
                  expected,
              )
  
              # For numeric values, the types should match too
              if isinstance(value, (int, float)):
                  tv = type(value)
                  te = type(expected)
                  assert tv is te, "type(%s.%s) = %r != %r" % (
                      w.__class__.__name__,
                      attr,
                      tv,
                      te,
                  )
  
imports: from __future__ import print_function
  import os
  from collections import OrderedDict
  import pytest
  import ipywidgets
  from traitlets import TraitError
  from ipywidgets import interact, interact_manual, interactive, interaction, Output
  from ipython_genutils.py3compat import annotate
  from .utils import setup, teardown
label_desc: Use image node_id 4 for calling a global function with example usage: check_widget(w) without return types