code: def matrix_to_nested_dictionary(
      X, row_keys=None, column_keys=None, filter_fn=None
  ):
      pair_dict = matrix_to_pair_dictionary(
          X,
          row_keys=row_keys,
          column_keys=column_keys,
          filter_fn=filter_fn,
      )
      return curry_pair_dictionary(pair_dict)
  
imports: from collections import defaultdict
  import numpy
  from scipy.sparse import dok_matrix
label_desc: Use image node_id 12 for calling a global function with example usage: matrix_to_nested_dictionary(X, row_keys, column_keys, filter_fn) and returns: curry_pair_dictionary