code: def create_context(task, dag=None):
      if dag is None:
          dag = DAG(dag_id="dag")
      tzinfo = pendulum.timezone("UTC")
      execution_date = timezone.datetime(
          2022, 1, 1, 1, 0, 0, tzinfo=tzinfo
      )
      dag_run = DagRun(
          dag_id=dag.dag_id,
          execution_date=execution_date,
          run_id=DagRun.generate_run_id(
              DagRunType.MANUAL, execution_date
          ),
      )
  
      task_instance = TaskInstance(task=task)
      task_instance.dag_run = dag_run
      task_instance.xcom_push = mock.Mock()
      return {
          "dag": dag,
          "ts": execution_date.isoformat(),
          "task": task,
          "ti": task_instance,
          "task_instance": task_instance,
          "run_id": dag_run.run_id,
          "dag_run": dag_run,
          "execution_date": execution_date,
          "data_interval_end": execution_date,
          "logical_date": execution_date,
      }
  
file_path: airflow/tests/providers/google/cloud/utils/airflow_util.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING
  from unittest import mock
  import pendulum
  from airflow.models import DAG, Connection
  from airflow.models.dagrun import DagRun
  from airflow.models.taskinstance import TaskInstance
  from airflow.utils import timezone
  from airflow.utils.types import DagRunType
label_desc: Use image node_id 4 for calling a global function with example usage: create_context(task, dag) and returns: dict