is `hasattr(app[attr], 'pop')` intended to check whether it's a dict?  could do `isinstance(app[attr], types.DictType)`