def getmembers(object, predicate=None):
    """A safe version of inspect.getmembers that handles missing attributes.

    This is useful when there are descriptor based attributes that for
    some reason raise AttributeError even though they exist.  This happens
    in zope.inteface with the __provides__ attribute.
    """
    results = []
    for key in dir(object):
        try:
            value = getattr(object, key)
        except __HOLE__:
            pass
        else:
            if not predicate or predicate(value):
                results.append((key, value))
    results.sort()
    return results


#-----------------------------------------------------------------------------
# Base TraitType for all traits
#-----------------------------------------------------------------------------
dataset/ETHPy150Open enthought/depsolver/depsolver/bundled/traitlets/_implementation.py/getmembers