code: def nested_key_indices(nested_dict):
      """
      Give an ordering to the outer and inner keys used in a dictionary that
      maps to dictionaries.
      """
      outer_keys, inner_keys = collect_nested_keys(nested_dict)
      outer_key_indices = {k: i for (i, k) in enumerate(outer_keys)}
      inner_key_indices = {k: i for (i, k) in enumerate(inner_keys)}
      return outer_key_indices, inner_key_indices
  
imports: from collections import defaultdict
  import numpy
  from scipy.sparse import dok_matrix
label_desc: Use image node_id 3 for calling a global function with example usage: nested_key_indices(nested_dict) and returns: outer_key_indices,  inner_key_indices