def _get_status(self, event):
        state = event.get('state')
        state_description = event.get('state_description')
        status = 'UNKNOWN'
        status_map = {
            "building": 'BUILD',
            "stopped": 'SHUTOFF',
            "paused": 'PAUSED',
            "suspended": 'SUSPENDED',
            "rescued": 'RESCUE',
            "error": 'ERROR',
            "deleted": 'DELETED',
            "soft-delete": 'SOFT_DELETED',
            "shelved": 'SHELVED',
            "shelved_offloaded": 'SHELVED_OFFLOADED',
        }
        if state in status_map:
            status = status_map[state]
        if state == 'resized':
            if state_description == 'resize_reverting':
                status = 'REVERT_RESIZE'
            else:
                status = 'VERIFY_RESIZE'
        if state == 'active':
            active_map = {
                "rebooting": 'REBOOT',
                "rebooting_hard": 'HARD_REBOOT',
                "updating_password": 'PASSWORD',
                "rebuilding": 'REBUILD',
                "rebuild_block_device_mapping": 'REBUILD',
                "rebuild_spawning": 'REBUILD',
                "migrating": 'MIGRATING',
                "resize_prep": 'RESIZE',
                "resize_migrating": 'RESIZE',
                "resize_migrated": 'RESIZE',
                "resize_finish": 'RESIZE',
            }
            status = active_map.get(state_description, 'ACTIVE')
        if status == 'UNKNOWN':
            logger.error("Unknown status for event %s: state %s (%s)" % (
                         event.get('message_id'), state, state_description))
        return status
dataset/ETHPy150Open openstack/stacktach-winchester/winchester/pipeline_handler.py/AtomPubHandler._get_status/original