Test object from ZODB is broken in Zope

All you Zopers out there, this is how you can test, in code, whether an object from database is broken or not:

from OFS.Uninstalled import BrokenClass
 
def is_broken(obj):
    return isinstance(obj, BrokenClass)