code: def gen_from_templates(templates):
      """Generate cython files from a list of templates"""
      # Lazy import because cython is not a runtime dependency.
      from Cython import Tempita
  
      for template in templates:
          outfile = template.replace(".tp", "")
  
          # if the template is not updated, no need to output the cython file
          if not (
              os.path.exists(outfile)
              and os.stat(template).st_mtime < os.stat(outfile).st_mtime
          ):
              with open(template, "r") as f:
                  tmpl = f.read()
  
              tmpl_ = Tempita.sub(tmpl)
  
              warn_msg = (
                  "# WARNING: Do not edit this file directly.\n"
                  f"# It is automatically generated from {template!r}.\n"
                  "# Changes must be made there.\n\n"
              )
  
              with open(outfile, "w") as f:
                  f.write(warn_msg)
                  f.write(tmpl_)
  
file_path: catboost/contrib/python/scikit-learn/py3/sklearn/_build_utils/__init__.py
imports: import contextlib
  import os
  import sklearn
  from .._min_dependencies import CYTHON_MIN_VERSION
  from ..externals._packaging.version import parse
  from .openmp_helpers import check_openmp_support
  from .pre_build_helpers import basic_check_build
label_desc: Use image node_id 3 for calling a global function with example usage: gen_from_templates(templates) without return types