code: def _getPredictionsGenerator(examplesDir, exampleName):
      """
      Get predictions generator for one of the quick-start example.
  
      .. note::
  
        The examples are not part of the nupic package so we need to manually
        append the example module path to syspath.
  
      :param examplesDir:
        (str) path to the example parent directory.
      :param exampleName:
        (str) name of the example. E.g: "opf", "network", "algo".
      :return predictionsGenerator:
        (function) predictions generator functions.
      """
  
      sys.path.insert(0, os.path.join(examplesDir, exampleName))
      modName = "complete-%s-example" % exampleName
      mod = __import__(modName, fromlist=["runHotgym"])
      return getattr(mod, "runHotgym")
  
file_path: nupic-legacy/tests/unit/nupic/docs/examples_test.py
imports: import os
  import sys
  import unittest2
  import numpy
  from numpy.testing import assert_approx_equal
  import random
label_desc: Use image node_id 1 for calling a global function with example usage: _getPredictionsGenerator(examplesDir, exampleName) and returns: getattr