code: def gc_helper(node_list):
      """
      Return the set of Variable instances which are computed by node_list.
      Parameters
      ----------
      node_list
          List of Apply instances in program execution order.
  
      Returns
      -------
      2-tuple
          FIRST, the set of Variable instances which are computed by node_list,
          and SECOND a dictionary that maps each Variable instance to a the last
          node to use Variable as an input.
  
      Extended Summary
      ----------------
      This is used to allow garbage collection within graphs.
  
      It ignores view_map and destroy_map. This isn't needed as python
      have reference count. In Theano gc, we should not take into
      account view_map and destroy_map as if the thunk decided to create
      a new output, we would delay uselessly its gc by Python.
  
      """
      # for freeing memory
      last_user = {}
      computed = set()
      for node in node_list:
          for input in node.inputs:
              last_user[input] = node
          for output in node.outputs:
              computed.add(output)
      return computed, last_user
  
imports: from __future__ import absolute_import, print_function, division
  from copy import copy, deepcopy
  from sys import getsizeof
  import sys
  import traceback
  import numpy
  import theano
  from theano.compat import izip
  from six import reraise
  from six.moves import StringIO
  from theano.gof import utils
  from theano.gof import graph
  from theano.gof.type import Type
  from .utils import undef
label_desc: Use image node_id 6 for calling a global function with example usage: gc_helper(node_list) and returns: computed,  last_user