def context_to_airflow_vars(context, in_env_var_format=False):
params = dict()<EOL>if in_env_var_format:<EOL><INDENT>name_format = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>name_format = '<STR_LIT:default>'<EOL><DEDENT>task_instance = context.get('<STR_LIT>')<EOL>if task_instance and task_instance.dag_id:<EOL><INDENT>params[AIRFLOW_VAR_NAME_FORMAT_MAPPING['<STR_LIT>'][<EOL>name_format]] = task_instance.dag_id<EOL><DEDENT>if task_instance and task_instance.task_id:<EOL><INDENT>params[AIRFLOW_VAR_NAME_FORMAT_MAPPING['<STR_LIT>'][<EOL>name_format]] = task_instance.task_id<EOL><DEDENT>if task_instance and task_instance.execution_date:<EOL><INDENT>params[<EOL>AIRFLOW_VAR_NAME_FORMAT_MAPPING['<STR_LIT>'][<EOL>name_format]] = task_instance.execution_date.isoformat()<EOL><DEDENT>dag_run = context.get('<STR_LIT>')<EOL>if dag_run and dag_run.run_id:<EOL><INDENT>params[AIRFLOW_VAR_NAME_FORMAT_MAPPING['<STR_LIT>'][<EOL>name_format]] = dag_run.run_id<EOL><DEDENT>return params<EOL>
Given a context, this function provides a dictionary of values that can be used to
externally reconstruct relations between dags, dag_runs, tasks and task_instances.
Default to abc.def.ghi format and can be made to ABC_DEF_GHI format if
in_env_var_format is set to True.

:param context: The context for the task_instance of interest.
:type context: dict
:param in_env_var_format: If returned vars should be in ABC_DEF_GHI format.
:type in_env_var_format: bool
:return: task_instance context as dict.