`'packaged' if is_packaged else 'hosted'` looks like it belongs in `app`.