code: def render_log_filename(
      ti: TaskInstance, try_number, filename_template
  ) -> str:
      """
      Given task instance, try_number, filename_template, return the rendered log filename.
  
      :param ti: task instance
      :param try_number: try_number of the task
      :param filename_template: filename template, which can be jinja template or
          python string template
      """
      (
          filename_template,
          filename_jinja_template,
      ) = parse_template_string(filename_template)
      if filename_jinja_template:
          jinja_context = ti.get_template_context()
          jinja_context["try_number"] = try_number
          return render_template_to_string(
              filename_jinja_template, jinja_context
          )
  
      return filename_template.format(
          dag_id=ti.dag_id,
          task_id=ti.task_id,
          execution_date=ti.execution_date.isoformat(),
          try_number=try_number,
      )
  
imports: from __future__ import annotations
  import copy
  import itertools
  import re
  import signal
  import warnings
  from datetime import datetime
  from functools import reduce
  from typing import TYPE_CHECKING, Any, Callable, Generator, Iterable, Mapping, MutableMapping, TypeVar, cast
  from lazy_object_proxy import Proxy
  from airflow.configuration import conf
  from airflow.exceptions import AirflowException, RemovedInAirflow3Warning
  from airflow.utils.module_loading import import_string
  from airflow.utils.types import NOTSET
label_desc: Use image node_id 12 for calling a global function with example usage: render_log_filename(ti, try_number, filename_template) and returns: filename_template, render_template_to_string