code: def create_log_model(
      create_task_instance, task_instance, session, request
  ):
      def maker(event, when, **kwargs):
          log_model = Log(
              event=event,
              task_instance=task_instance,
              **kwargs,
          )
          log_model.dttm = when
  
          session.add(log_model)
          session.flush()
          return log_model
  
      return maker
  
imports: from __future__ import annotations
  import pytest
  from airflow.api_connexion.exceptions import EXCEPTIONS_LINK_MAP
  from airflow.models import Log
  from airflow.security import permissions
  from airflow.utils import timezone
  from tests.test_utils.api_connexion_utils import assert_401, create_user, delete_user
  from tests.test_utils.config import conf_vars
  from tests.test_utils.db import clear_db_logs
label_desc: Use image node_id 4 for calling a global function with example usage: create_log_model(create_task_instance, task_instance, session, request) and returns: maker, log_model