Give an ordering to the outer and inner keys used in a dictionary that
    maps to dictionaries.

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