def status_from_state(vm_state, task_state='default'):
 task_map = _STATE_MAP.get(vm_state, dict(default='UNKNOWN'))
 status = task_map.get(task_state, task_map['default'])
 if (status == 'UNKNOWN'):
  LOG.error(_LE('status is UNKNOWN from vm_state=%(vm_state)s task_state=%(task_state)s. Bad upgrade or db corrupted?'), {'vm_state': vm_state, 'task_state': task_state})
 return status

def status_from_state ( vm_state , task_state = 'default' ) : task_map = _STATE_MAP . get ( vm_state , dict ( default = 'UNKNOWN' ) ) status = task_map . get ( task_state , task_map [ 'default' ] ) if ( status == 'UNKNOWN' ) : LOG . error ( _LE ( 'status is UNKNOWN from vm_state=%(vm_state)s task_state=%(task_state)s. Bad upgrade or db corrupted?' ) , { 'vm_state' : vm_state , 'task_state' : task_state } ) return status
given vm_state and task_state .