When using kalman filter for dynamic hedge ratio of a cointegrated pair, will you consider C++ libraries such as KFilter, or R packages such as KFAS, DLM, or code one by yourself?

Also, it's greatly appreciated if someone can demonstrate a simple example since I got stuck on this issue for a long time crazy .