def _bunchify(b):
    """Ensure all dict elements are Bunch."""
    assert isinstance(b, dict)
    b = Bunch(b)
    for k in b:
        if isinstance(b[k], dict):
            b[k] = Bunch(b[k])
    return b
Ensure all dict elements are Bunch.