Perform templating according to the given arguments.

def perform_templating(args):
    """Perform templating according to the given arguments."""
    engine = engines.engines[args.engine]

    if args.vary:
        it = variable_outfile_iterator(args.outfiles,
                                       args.infiles,
                                       args.args,
                                       engine)
    else:
        it = constant_outfile_iterator(args.outfiles,
                                       args.infiles,
                                       args.args)

    process_combinations(it, engine,
                         tolerant=args.tolerant,
                         read_old=args.read_old,
                         delete_empty=args.delete_empty,
                         )