Descendant in query script

Hi Team,
How can we make use of “Descendants of” in query script. I need to compare the sales team for the sales person using “Descendant of”. Looking for some example or syntax. Please advise.

Thanks.

Please check the example:

from frappe.utils.nestedset import get_descendants_of

descendants = get_descendants_of("Item Group", "IG Main")

item = frappe.get_all("Item",
    filters={
        "item_group": ["in", descendants]
    },
    fields=["name", "gst_hsn_code", "valuation_rate"]
)

Output:

[{'name': 'RM 4', 'gst_hsn_code': '051000', 'valuation_rate': 400.0},
 {'name': 'RM 2', 'gst_hsn_code': '051000', 'valuation_rate': 100.0},
 {'name': 'RM 1', 'gst_hsn_code': '051000', 'valuation_rate': 100.0},
 {'name': 'RM 3', 'gst_hsn_code': '051000', 'valuation_rate': 300.0}]

cross-checking the output from the user interface for comparison.