(obj, attr, default=_NOTSET)
Works exactly like getattr(), except that attr can be a nested attribute
    (e.g. "attr1.attr2.attr3").
Works exactly like getattr(), except that attr can be a nested attribute
    (e.g. "attr1.attr2.attr3").
Works exactly like getattr () except that attr can be a nested attribute ( e . g . attr1 . attr2 . attr3 ) .
def deepgetattr(obj, attr, default=_NOTSET):
    """Works exactly like getattr(), except that attr can be a nested attribute
    (e.g. "attr1.attr2.attr3").
    """
    try:
        return attrgetter(attr)(obj)
    except AttributeError:
        if default is _NOTSET:
            raise
        return default
def deepgetattr ( obj , attr , default = _NOTSET ) : try : return attrgetter ( attr ) ( obj ) except AttributeError : if default is _NOTSET : raise return default