def METHOD_NAME(self, output_dir, dag_to_generate=None):
    """Write DAG representation as Airflow dags to file."""
    # https://pythonspeed.com/articles/python-multiprocessing/
    # when running tests on CI that call this function, we need
    # to create a custom pool to prevent processes from getting stuck
    # Generate a single DAG:
    if dag_to_generate is not None:
        dag_to_generate.with_upstream_dependencies(self)
        dag_to_generate.with_downstream_dependencies(self)
        self.dag_to_airflow(output_dir, dag_to_generate)
        return
    # Generate all DAGs:
    try:
        set_start_method("spawn")
    except Exception:
        pass
    for dag in self.dags:
        dag.with_upstream_dependencies(self)
        dag.with_downstream_dependencies(self)
    to_airflow_dag = partial(self.dag_to_airflow, output_dir)
    with get_context("spawn").Pool(8) as p:
        p.map(to_airflow_dag, self.dags)