code: def memodict(f):
      """
      Memoization decorator for a function taking a single argument.
  
      """
  
      class memodict(defaultdict):
          def __missing__(self, key):
              ret = self[key] = f(key)
              return ret
  
      return memodict().__getitem__
  
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 1 for calling a global function with example usage: memodict(f) and returns: memodict, ret