code: def reverse_dict(d):
      """
      Reverses direction of dependence dict.
  
      Notes
      -----
      dict order is not deterministic. As we iterate on the
      input dict, it makes the output of this function depend on the
      dict order. So this function output order should be considered
      as undeterministic.
  
      Examples
      --------
      >>> d = {'a': (1, 2), 'b': (2, 3), 'c':()}
      >>> reverse_dict(d)
      {1: ('a',), 2: ('a', 'b'), 3: ('b',)}
  
      """
      result = {}
      for key in d:
          for val in d[key]:
              result[val] = result.get(val, tuple()) + (key,)
      return result
  
file_path: Theano/theano/gof/sched.py
imports: from __future__ import absolute_import, print_function, division
  from collections import defaultdict
  from six import iteritems
  from theano.gof.graph import list_of_nodes
  from theano.compat import cmp
label_desc: Use image node_id 4 for calling a global function with example usage: reverse_dict(d) and returns: result