def _instance_in_resize_state(instance):
 vm = instance.vm_state
 task = instance.task_state
 if (vm == vm_states.RESIZED):
  return True
 if ((vm in [vm_states.ACTIVE, vm_states.STOPPED]) and (task in [task_states.RESIZE_PREP, task_states.RESIZE_MIGRATING, task_states.RESIZE_MIGRATED, task_states.RESIZE_FINISH, task_states.REBUILDING])):
  return True
 return False

def _instance_in_resize_state ( instance ) : vm = instance . vm_state task = instance . task_state if ( vm == vm_states . RESIZED ) : return True if ( ( vm in [ vm_states . ACTIVE , vm_states . STOPPED ] ) and ( task in [ task_states . RESIZE_PREP , task_states . RESIZE_MIGRATING , task_states . RESIZE_MIGRATED , task_states . RESIZE_FINISH , task_states . REBUILDING ] ) ) : return True return False
returns true if the instance is in one of the resizing states .