'Assert state of VM is equal to state passed as parameter.'

def _assert_state(self, state_dict):

    instances = db.instance_get_all(self.context)
    self.assertEqual(len(instances), 1)
    if ('vm_state' in state_dict):
        self.assertEqual(state_dict['vm_state'], instances[0]['vm_state'])
    if ('task_state' in state_dict):
        self.assertEqual(state_dict['task_state'], instances[0]['task_state'])
    if ('power_state' in state_dict):
        self.assertEqual(state_dict['power_state'], instances[0]['power_state'])
