def _generateFileFromTemplates(templateFileNames, outputFilePath,<EOL>replacementDict):
<EOL>installPath = os.path.dirname(__file__)<EOL>outputFile = open(outputFilePath, "<STR_LIT:w>")<EOL>outputLines = []<EOL>inputLines = []<EOL>firstFile = True<EOL>for templateFileName in templateFileNames:<EOL><INDENT>if not firstFile:<EOL><INDENT>inputLines.extend([os.linesep]*<NUM_LIT:2>)<EOL><DEDENT>firstFile = False<EOL>inputFilePath = os.path.join(installPath, templateFileName)<EOL>inputFile = open(inputFilePath)<EOL>inputLines.extend(inputFile.readlines())<EOL>inputFile.close()<EOL><DEDENT>print("<STR_LIT>", len(inputLines), "<STR_LIT>")<EOL>for line in inputLines:<EOL><INDENT>tempLine = line<EOL>for k, v in replacementDict.items():<EOL><INDENT>if v is None:<EOL><INDENT>v = "<STR_LIT:None>"<EOL><DEDENT>tempLine = re.sub(k, v, tempLine)<EOL><DEDENT>outputFile.write(tempLine)<EOL><DEDENT>outputFile.close()<EOL>
Generates a file by applying token replacements to the given template
    file

    templateFileName:
                    A list of template file names; these files are assumed to be in
                    the same directory as the running experiment_generator.py script.
                    ExpGenerator will perform the substitution and concanetate
                    the files in the order they are specified

    outputFilePath: Absolute path of the output file

    replacementDict:
                    A dictionary of token/replacement pairs