code: def create_jinja_env(
      paths: Optional[List[str]],
      search_paths: Optional[List[str]],
      pkg_path: str,
      check: Optional[str] = None,
  ) -> jinja2.Environment:
      all_paths = paths or search_paths or []
      loaders: List[jinja2.BaseLoader] = [
          jinja2.FileSystemLoader(searchpath=path) for path in all_paths
      ]
      loaders.append(jinja2.PackageLoader("tslumen", pkg_path))
      env = jinja2.Environment(loader=jinja2.ChoiceLoader(loaders))
      if check:
          env.get_template(
              check
          )  # simple canary test just to see if templates can be reached
  
      env.filters["html"] = filter_html
      env.filters["dateformat"] = filter_dateformat
      env.filters["numberformat"] = filter_numberformat
      env.filters["autoformat"] = filter_autoformat
      env.filters["idhtml"] = filter_idhtml
      env.filters["islist"] = filter_islist
  
      return env
  
file_path: tslumen/tslumen/jinja_utils.py
imports: from math import ceil, log10, floor
  from typing import List, Optional, Any, Tuple
  from datetime import datetime
  import re
  import numpy
  import pandas
  import jinja2
label_desc: Use image node_id 9 for calling a global function with example usage: create_jinja_env(paths, search_paths, pkg_path, check) and returns: env