def is_object_pinned(obj):
    """Recursively check all members of the object and return True if only if
    all are pinned."""

    for attr in get_nonproperty_attributes(obj):
        member_result = recursive_apply_reduce_all(
            getattr(obj, attr),
            lambda x: x is None or x.is_pinned(),
        )
        if not member_result:
            return False
    return True
Recursively check all members of the object and return True if only if
    all are pinned.
python/dgl/graphbolt/base.py