code: def _unflatten_nested_keys(dictionary):
      """
      Unflatten the nested values of a dictionary based on the keys that are tuples.
  
      E.g., {("a", "b"): [1], ("a", "c"): [2]} becomes {"a": {"b": [1], "c": [2]}}
      """
      # Find the parameters that are nested dictionaries
      nested_keys = {k[0] for k in dictionary if isinstance(k, tuple)}
      # Select the parameters which were originally nested and unflatten them
      nested_dict = {
          nk: {k[1]: v for k, v in dictionary.items() if k[0] == nk}
          for nk in nested_keys
      }
      # Get original dictionary without the nested keys
      dictionary_without_nested_keys = {
          k: v
          for k, v in dictionary.items()
          if not isinstance(k, tuple)
      }
      # Return merged dicts
      return {**dictionary_without_nested_keys, **nested_dict}
  
imports: import logging
  from collections.abc import Iterable
  from itertools import islice, product
  import numpy
  import pandas
  from tqdm import tqdm
  from ..evaluation import hits_at_n_score, mr_score, mrr_score
label_desc: Use image node_id 4 for calling a global function with example usage: _unflatten_nested_keys(dictionary) and returns: dict