Set row height of a group with (Blanks) to 0

I have an AG grid with parent as Y and it has a child with the same name Y. The child has a child called Y which has a tree of (Blanks) as children.
I would like to hide all the children of the main parent where the name is the same, in this case Y and has (Blanks) underneath it as children. See the highlighted rows, which I want to hide or set rowHeight to 0. See getRowHeight property in grid_options

Sample dataset in the dataframe looks like

columns_defs = [
{“field”: “index”, “hide”: True},
{“field”: “LEVEL1”, “rowGroupIndex”: 1, “rowGroup”: True, “hide”: True},
{“field”: “LEVEL2”, “rowGroupIndex”: 2, “rowGroup”: True, “hide”: True},
{“field”: “LEVEL3”, “rowGroupIndex”: 3, “rowGroup”: True, “hide”: True},
{“field”: “LEVEL4”, “rowGroupIndex”: 4, “rowGroup”: True,“hide”: True},
{“field”: “LEVEL5”, “rowGroupIndex”: 5, “rowGroup”: True,“hide”: True},
{“field”: “LEVEL6”, “rowGroupIndex”: 6, “rowGroup”: True,“hide”: True},
{
“headerName”: “VALUE 1”,
“field”: “VALUE1”,
“aggFunc”: “sum”,

},
{
    "headerName": "VALUE 2",
    "field": "VALUE2",
    "aggFunc": "sum",


},
{
    "headerName": "VALUE 3",
    "field": "VALUE3",
    "aggFunc": "sum",

},
{
    "headerName": "VALUE 4",
    "field": "VALUE4",
    "cellRenderer": "agSparklineCellRenderer",
    "aggFunc": {"function": "customSparkLineAdding(params, 'VALUE4')"},

},
{
    "headerName": "VALUE 5",
    "field": "VALUE5",
    "aggFunc": "sum",

},
{
    "headerName": "VALUE 6",
    "field": "VALUE5",
    "aggFunc": "sum",

},

]

Set default column properties

default_col_def = dict(
resizable=True,
sizeColumnsToFit=True,
wrapText=True,
cellRendererParams={“suppressCount”: True},
sortable=False
)

grid_options = {
“groupDisplayType”: ‘singleColumn’,
"groupAllowUnbalanced ": True,
“maintainColumnOrder”: True,
“autoSizeColumns”: True,
“groupIncludeTotalFooter”: True,
“suppressAggFuncInHeader”: True,
“groupRemoveLowestSingleChildren”: True,
“autoGroupColumnDef”: dict(width=500,
field=“LEVEL6”,
headerName=“Name”,
headerTooltip=“Name”, ),
“groupDefaultExpanded”: 0,
“getRowHeight”: {
“function”:
‘params.node.aggData ? ((params.node.aggData.LEVEL2 === “Y”) ? 0 : 40) : 40’
},
}

layout = html.Div(
[
dag.AgGrid(
enableEnterpriseModules=True,
licenseKey=[‘MY_LICENSE’],
columnDefs=columns_defs,
rowData=data.to_dict(‘records’),
dashGridOptions=grid_options,
defaultColDef=default_col_def,
className=“ag-theme-balham”,
),
],
style={“margin”: 20},
)