Iterate over variable output file name template.

def variable_outfile_iterator(outfiles, infiles, arggroups, engine):
    """Iterate over variable output file name template."""
    assert len(outfiles) == 1

    template = engine(outfiles[0], tolerant=False)

    for infile in infiles:
        properties = make_path_properties(infile, prefix='')

        for arggroup in arggroups:
            outfile = template.apply(dict(arggroup, **properties))
            yield (outfile, infile, arggroup)