code: def collect_nested_keys(nested_dict):
      outer_key_list = list(sorted(nested_dict.keys()))
      inner_key_set = set([])
      for k in outer_key_list:
          inner_dict = nested_dict[k]
          inner_key_set = inner_key_set.union(inner_dict.keys())
      inner_key_list = list(sorted(inner_key_set))
      return outer_key_list, inner_key_list
  
imports: from collections import defaultdict
  import numpy
  from scipy.sparse import dok_matrix
label_desc: Use image node_id 2 for calling a global function with example usage: collect_nested_keys(nested_dict) and returns: outer_key_list,  inner_key_list