code: def load_lib(filename):
      
      # Open the file.
      if not os.path.exists(filename):
          raise IOError('No such file: %s' % filename)
  
      name = os.path.splitext(os.path.basename(filename))[0]
      if sys.version_info[0] < 3:
          module = imp.load_source(name, filename)
      else:
          module = importlib.machinery.SourceFileLoader(name, filename).load_module()
  
      return dict((name + '.' + k, v) for (k, v) in list(module.__lib__.items()))
docs: Loads a Python file containing functions, and returns the
      content of the __lib__ variable. The __lib__ variable must contain
      a dictionary mapping function names to callables.
  
      Returns a dictionary mapping the namespaced function names to
      callables. The namespace is the basename of the file, without file
      extension.
  
      The result of this function can later be passed to run_template::
  
          functions = load_lib('my_library.py')
          run_template(conn, 'foo.exscript', **functions)
  
      :type  filename: string
      :param filename: A full filename.
      :rtype:  dict[string->object]
      :return: The loaded functions.