code: def gen_command(config, template_path, out_path):
      print(f'Generating from "{template_path}" to "{out_path}"')
  
      def replace_fn(match):
          return str(getattr(config, match.groups()[0]))
  
      with open(template_path, "r") as in_f:
          with open(out_path, "w") as out_f:
              dat = in_f.read()
              updated_dat = re.sub(r"{{ (.+) }}", replace_fn, dat)
              out_f.write(updated_dat)
  
file_path: gluon-nlp/scripts/question_answering/commands/generate_commands.py
imports: import re
  import os
  from gluonnlp.utils.config import CfgNode
label_desc: Use image node_id 15 for calling a global function with example usage: gen_command(config, template_path, out_path) and returns: str