code: def settings_context(content, directory=None, name="LOGGING_CONFIG"):
      """
      Sets a settings file and puts it in the Python classpath
  
      :param content:
            The content of the settings file
      :param directory: the directory
      :param name: str
      """
      initial_logging_config = os.environ.get(
          "AIRFLOW__LOGGING__LOGGING_CONFIG_CLASS", ""
      )
      try:
          settings_root = tempfile.mkdtemp()
          filename = f"{SETTINGS_DEFAULT_NAME}.py"
          if directory:
              # Create the directory structure with __init__.py
              dir_path = os.path.join(settings_root, directory)
              pathlib.Path(dir_path).mkdir(parents=True, exist_ok=True)
  
              basedir = settings_root
              for part in directory.split("/"):
                  open(
                      os.path.join(basedir, "__init__.py"), "w"
                  ).close()
                  basedir = os.path.join(basedir, part)
              open(os.path.join(basedir, "__init__.py"), "w").close()
  
              # Replace slashes by dots
              module = (
                  directory.replace("/", ".")
                  + "."
                  + SETTINGS_DEFAULT_NAME
                  + "."
                  + name
              )
              settings_file = os.path.join(dir_path, filename)
          else:
              module = SETTINGS_DEFAULT_NAME + "." + name
              settings_file = os.path.join(settings_root, filename)
  
          with open(settings_file, "w") as handle:
              handle.writelines(content)
          sys.path.append(settings_root)
  
          # Using environment vars instead of conf_vars so value is accessible
          # to parent and child processes when using 'spawn' for multiprocessing.
          os.environ["AIRFLOW__LOGGING__LOGGING_CONFIG_CLASS"] = module
          yield settings_file
  
      finally:
          os.environ[
              "AIRFLOW__LOGGING__LOGGING_CONFIG_CLASS"
          ] = initial_logging_config
          sys.path.remove(settings_root)
  
imports: from __future__ import annotations
  import contextlib
  import importlib
  import logging
  import os
  import pathlib
  import sys
  import tempfile
  from unittest.mock import patch
  import pytest
  from airflow.configuration import conf
  from tests.test_utils.config import conf_vars
label_desc: Use image node_id 2 for calling a global function with example usage: settings_context(content, directory, name) without return types