def METHOD_NAME(app: FastAPI) -> BackgroundLogFetcher | None:
    if hasattr(app.state, "background_log_fetcher"):
        return cast(BackgroundLogFetcher, app.state.background_log_fetcher)
    return None