def METHOD_NAME(args, invocations):
    header_title = "API"
    if args.libsel4:
        header_title = "LIBSEL4"
    if args.arch:
        template = Environment(loader=BaseLoader).from_string(ARCH_INVOCATION_TEMPLATE)
    elif args.sel4_arch:
        template = Environment(loader=BaseLoader).from_string(SEL4_ARCH_INVOCATION_TEMPLATE)
    else:
        template = Environment(loader=BaseLoader).from_string(INVOCATION_TEMPLATE)
    data = template.render({'header_title': header_title, 'libsel4': args.libsel4,
                            'invocations': invocations, 'num_invocations': len(invocations)})
    args.dest.write(data)
    args.dest.close()