1target = {'foo': 'FOO'} 2 3 4def is_instance(obj, klass): 5 """Version of is_instance that doesn't access __class__""" 6 return issubclass(type(obj), klass) 7 8 9class SomeClass(object): 10 class_attribute = None 11 12 def wibble(self): 13 pass 14 15 16class X(object): 17 pass 18 19 20def examine_warnings(func): 21 def wrapper(): 22 with catch_warnings(record=True) as ws: 23 func(ws) 24 return wrapper 25