def resolve_templating_engine(args):
    """ Figures out what templating engine should be used to render the stack
    """
    # Figure out what templating engine to use.
    # Only use -t option when stack comes from stdin
    if args.stack.name == "<stdin>":
        return args.templating_engine
    elif ".mako" in args.stack.name[-5:]:
        return "mako"
    elif ".jinja" in args.stack.name[-6:]:
        return "jinja"
    elif ".yaml" in args.stack.name[-5:]:
        return "yaml"
    raise NotImplementedError("Templating engine not supported. Must be set "
                              "to 'mako', 'jinja', or '' in the command line "
                              "or by using the equivalent file extension")