code: def subst_vars(target, source, d):
      """Substitute any occurrence of @foo@ by d['foo'] from source file into
      target."""
      var = re.compile("@([a-zA-Z_]+)@")
      fs = open(source, "r")
      try:
          ft = open(target, "w")
          try:
              for l in fs:
                  m = var.search(l)
                  if m:
                      ft.write(
                          l.replace("@%s@" % m.group(1), d[m.group(1)])
                      )
                  else:
                      ft.write(l)
          finally:
              ft.close()
      finally:
          fs.close()
  
imports: from __future__ import division, absolute_import, print_function
  import os
  import re
  import sys
  import shlex
  import copy
  from distutils.command import build_ext
  from distutils.dep_util import newer_group, newer
  from distutils.util import get_platform
  from distutils.errors import DistutilsError, DistutilsSetupError
  from numpy.distutils import log
  from numpy.distutils.misc_util import fortran_ext_match, appendpath, is_string, is_sequence, get_cmd
  from numpy.distutils.from_template import process_file
  from numpy.distutils.conv_template import process_file
label_desc: Use image node_id 1 for calling a global function with example usage: subst_vars(target, source, d) without return types