# Metric density theorem in most general setting?

It's a consequence of Lebesgue's theorem that every measurable $E\subset\mathbb{R}^n$ has a metric density that's $1$ a.e. on $E$ and $0$ a.e. on $\mathbb{R}^n\setminus E$. What are the most general conditions on the measure space for this property to hold?

-