How might one determine if a new model context is identical to an old one?

For example:

```
y = np.random.randn(10)
with pm.Model() as model_1:
noise = pm.Gamma('noise', alpha=2, beta=1)
y_observed = pm.Normal('y_observed', mu=0, sigma=noise, observed=y)
with pm.Model() as model_2:
noise = pm.Gamma('noise', alpha=2, beta=1)
y_observed = pm.Normal('y_observed', mu=0, sigma=noise, observed=y)
```

`model_1`

and `model_2`

are identical. If I’ve sampled from one I don’t need to waste time sampling from the other. But I’m not sure how to test for their identity. `model_1 == model_2`

and `hash(model_1) == hash(model_2)`

are both `False`

. Maybe this can be done by recursively checking through each element of `__getstate()__`

or `__dict__`

, but before I try that I’d be interested to know if there is a neater solution.