you could rewrite this to something like this:

```python
guids = dict((a.short, a.guid) for a in amo.APPS.values())
if application not in guids:
    raise CommandError('Application %r does not exist.' % application)
app_id = guids[application]
```