docstr: Here we actually generate the wrapper code. Separating this from preparation
  allows us to cross-reference between algos, for example for multi-phased algos.
  
  We combine the argument (template, input, parameter) information appropriately.
  We take care of the right order and bring them
  in the right format for our jinja templates.
  We pass them to the templates in a dict jparams, used a globals vars for jinja.
  
  Handling single-phased algos only which are not part of a multi-phased algo
docstr_tok: ["Here","we","actually","generate","the","wrapper","code",".","Separating","this","from","preparation","allows","us","to","cross-reference","between","algos",",","for","example","for","multi-phased","algos",".","We","combine","the","argument","(","template",",","input",",","parameter",")","information","appropriately",".","We","take","care","of","the","right","order","and","bring","them","in","the","right","format","for","our","jinja","templates",".","We","pass","them","to","the","templates","in","a","dict","jparams",",","used","a","globals","vars","for","jinja",".","Handling","single-phased","algos","only","which","are","not","part","of","a","multi-phased","algo"]
code: def gen_wrapper(self, ns, algo):
      """
      Here we actually generate the wrapper code. Separating this from preparation
      allows us to cross-reference between algos, for example for multi-phased algos.
  
      We combine the argument (template, input, parameter) information appropriately.
      We take care of the right order and bring them
      in the right format for our jinja templates.
      We pass them to the templates in a dict jparams, used a globals vars for jinja.
  
      Handling single-phased algos only which are not part of a multi-phased algo
      """
      cfg = self.algocfg[ns + "::" + algo]
      cpp_begin, pyx_begin, pyx_end, typesstr = "", "", "", ""
  
      cpp_map, cpp_end, pyx_map = self.gen_modelmaps(ns, algo)
      a, b, c = self.gen_resultmaps(ns, algo)
      cpp_map += a
      cpp_end += b
      pyx_map += c
  
      if len(cfg["params"]) == 0:
          return (
              cpp_map,
              cpp_begin,
              cpp_end,
              pyx_map,
              pyx_begin,
              pyx_end,
              typesstr,
          )
  
      jparams = cfg["params"].copy()
      jparams.update(cfg["params"]["params_templ"])
      jparams["create"] = cfg["create"]
      jparams["add_setup"] = cfg["add_setup"]
      jparams["add_get_result"] = cfg["add_get_result"]
      jparams["model_maps"] = cfg["model_typemap"]
      jparams["result_map"] = cfg["result_typemap"]
      jparams["params_ds"] = (
          jparams["params_req"]
          + jparams["params_opt"]
          + [cfg["distributed"], cfg["streaming"]]
      )
      jparams["params_all"] = (
          jparams["params_req"]
          + (
              jparams["template_args"]
              if jparams["template_args"]
              else []
          )
          + jparams["params_opt"]
          + [cfg["distributed"], cfg["streaming"]]
      )
      jparams["args_all"] = (
          jparams["input_args"]
          + jparams["params_req"]
          + jparams["params_opt"]
      )
  
      for p in ["distributed", "streaming"]:
          if p in cfg:
              jparams[p] = cfg[p]
  
      t = jenv.from_string(algo_iface_template)
      cpp_begin += t.render(**jparams) + "\n"
  
      if jparams:
          if "dist" in cfg:
              # a wrapper for distributed mode
              jparams.update(cfg["dist"])
  
          t = jenv.from_string(manager_wrapper_template)
          cpp_begin += t.render(**jparams) + "\n"
  
          t = jenv.from_string(hpat_spec_template)
          pyx_begin += t.render(**jparams) + "\n"
  
          # this is our actual API wrapper
          t = jenv.from_string(parent_wrapper_template)
          pyx_end += t.render(**jparams) + "\n"
  
          # the C function generating specialized classes
          t = jenv.from_string(algo_wrapper_template)
          cpp_end += t.render(**jparams) + "\n"
  
      return (
          cpp_map,
          cpp_begin,
          cpp_end,
          pyx_map,
          pyx_begin,
          pyx_end,
          typesstr,
      )
  
file_path: scikit-learn-intelex/generator/wrapper_gen.py
imports: import re
  import jinja2
  from jinja2 import select_autoescape
  from .wrappers import hpat_types
label_desc: Use image node_id 6 for calling the wrapper_gen obj's underlying member method code with example usage: obj.gen_wrapper(ns, algo) and returns: cpp_map,  cpp_begin,  cpp_end,  pyx_map,  pyx_begin,  pyx_end,  typesstr, cpp_map,  cpp_begin,  cpp_end,  pyx_map,  pyx_begin,  pyx_end,  typesstr