code: def assemble(template, **kwargs):
      pattern = re.compile("@@@@(.*?)\n((.|\n)*?)\n####", re.MULTILINE)
      temp_info = pattern.findall(template)
      # print(temp_info)
      mapping = dict()
      rep_map = dict()
  
      # drop repetive field from mapping
      for k, v in kwargs.items():
          if isinstance(v, list):
              rep_map[k] = v
          else:
              mapping[k] = v
  
      for k, v, _ in temp_info:
          info = k.split("@")
          new_v = replace_all(v, **mapping)
          assert 1 <= len(info) <= 2
          if len(info) == 2:
              k = info[0]
              rep = info[1]
              new_v = "\n\n".join(
                  [
                      new_v.replace("@@" + rep + "@@", rep_v)
                      for rep_v in rep_map[rep]
                  ]
              )
          mapping[k] = new_v
      return mapping["main"]
  
label_desc: Use image node_id 1 for calling a global function with example usage: assemble(template) and returns: mapping