def METHOD_NAME(dag, session=None):
    ti: TaskInstance = (
        session.query(TaskInstance)
        .filter(
            TaskInstance.dag_id == dag.dag_id,
            TaskInstance.task_id == "load",
            TaskInstance.execution_date == dag.latest_execution_date,
        )
        .first()
    )
    return ti.duration