Good way here: get_nodes_to_report(data['nodes']), because in method get_nodes_to_report you do exactly this thing.