def migrate_vm(vm_object, host_object):
 relocate_spec = vim.vm.RelocateSpec(host=host_object)
 task_object = vm_object.Relocate(relocate_spec)
 return task_object

def migrate_vm ( vm_object , host_object ) : relocate_spec = vim . vm . RelocateSpec ( host = host_object ) task_object = vm_object . Relocate ( relocate_spec ) return task_object
migrate virtual machine and return the task .