human
Solve the following python programming problem given the following code:
def destroy_portgroup(self, portgroup_id) : 
    def portgroup_not_empty(session) : 
        'Checks whether the portgroup does not have ports.' 
        query = model_query (models.Port) 
        query = add_port_filter_by_portgroup (query, portgroup_id) 
        return (query.count () != 0) 
with _session_for_write () as session : 
        if portgroup_not_empty (session) : 
            raise exception.PortgroupNotEmpty (portgroup = portgroup_id) 
query = model_query (models.Portgroup, session = query) 
        query = add_identity_filter (query, portgroup_id) 
        count = query.delete () 
        if (count == 0) : 
            raise exception.PortgroupNotFound (portgroup = portgroup_id) 

    
    

    Fix the buggy line: query = model_query (models.Portgroup, session = query)
assistant
#Here is Python program to fix the buggy line: query = model_query (models.

query = model_query (models.Portgroup, session = session)