def handle(self, *args, **kw):
        apps = {}
        for id, app in amo.APP_IDS.iteritems():
            apps[id] = dict(guid=app.guid, versions=[],
                            name=amo.APPS_ALL[id].short)
        versions = (AppVersion.objects.values_list('application', 'version')
                    .order_by('version_int'))
        for app, version in versions:
            try:
                apps[app]['versions'].append(version)
            except __HOLE__:
                # Sunbird is still in the database but shouldn't show up here.
                pass

        # Local file, to be read by validator.
        with storage.open(self.JSON_PATH, 'w') as f:
            json.dump(apps, f)
            log.debug("Wrote: %s" % f.name)
dataset/ETHPy150Open mozilla/addons-server/src/olympia/applications/management/commands/dump_apps.py/Command.handle