def _template_formatter(self, template_dir, template_file, var_dict):
        if type(template_dir) is not str:
            sys.exit(codes.mapping['template_dir_must_be_of_type_string'])
        if os.path.isdir(template_dir):
            env = jinja.Environment(loader=jinja.FileSystemLoader(
                template_dir))
        else:
            lgr.error('Template dir missing.')
            sys.exit(codes.mapping['template_dir_missing'])
        if type(template_file) is not str:
            sys.exit(codes.mapping['template_file_must_be_of_type_string'])
        if os.path.isfile(os.path.join(template_dir, template_file)):
            template = env.get_template(template_file)
        else:
            lgr.error('Template file missing.')
            sys.exit(codes.mapping['template_file_missing'])

        try:
            lgr.debug('Generating template from {0}/{1}.'.format(
                      template_dir, template_file))
            return template.render(var_dict)
        except Exception as e:
            lgr.error('Could not generate template ({0}).'.format(e))
            sys.exit(codes.mapping['could_not_generate_template'])
Helper parse action to convert tokens to upper case.
dataset/ETHPy150Open cloudify-cosmo/packman/packman/templater.py/Handler._template_formatter--crossover with--dataset/ETHPy150Open pypa/pip/pip/_vendor/pyparsing.py/upcaseTokens