def METHOD_NAME(
    pipeline_run: models.DatabasePipelineRun,
) -> datetime.datetime:
    max_pipeline_run_duration = datetime.timedelta(
        minutes=interface.PIPELINES_TIMEOUT + 5
    )  # Add 5 minutes tolerance to pipeline timeout
    return min(
        pipeline_run.trigger_time.replace(tzinfo=datetime.UTC)
        + max_pipeline_run_duration,
        (pipeline_run.end_time or datetime.datetime.now(datetime.UTC)).replace(
            tzinfo=datetime.UTC
        ),
    )