def get_level(index) -> int:
    """Returns the hierarchical depth level of the given index."""
    level = 0
    while index.parent().isValid():
        index = index.parent()
        level += 1
    return level
Returns the hierarchical depth level of the given index.
angrmanagement/ui/widgets/qproperty_editor.py