Implementing Distance-Dependent CRP Mixture Model

The Dirichlet Process Mixture Model tutorial (Dirichlet Process Mixture Models in Pyro — Pyro Tutorials 1.8.4 documentation) is wonderful. I’m wondering how I would go about changing the Dirichlet Process prior over clusters to a Distance-Dependent Chinese Restaurant Process prior over clusters?