code: def iterable_to_function(gen):
      gen = iter(gen)
      data = []
  
      def f(k):
          for i in xrange(len(data), k + 1):
              data.append(next(gen))
          return data[k]
  
      return f
  
file_path: catboost/contrib/python/mpmath/py3/mpmath/calculus/differentiation.py
imports: from ..libmp.backend import xrange
  from .calculus import defun
label_desc: Use image node_id 6 for calling a global function with example usage: iterable_to_function(gen) and returns: f, data