<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def template_subs_file(in_file, out_fobj, d):
 """ Substitute template arguments in in_file from variables in d, write the result to out_fobj. """

    with open(in_file, 'r') as in_fobj:
        for line in in_fobj:
            out_fobj.write(line.format(**d))