'Stop an instance in its cell.
This method takes a new-world instance object.'

def stop_instance(self, ctxt, instance, do_cast=True, clean_shutdown=True):

    msg_args = {'instance': instance, 'do_cast': do_cast}
    if self.client.can_send_version('1.31'):
        version = '1.31'
        msg_args['clean_shutdown'] = clean_shutdown
    else:
        version = '1.12'
    cctxt = self.client.prepare(version=version)
    method = ((do_cast and cctxt.cast) or cctxt.call)
    return method(ctxt, 'stop_instance', **msg_args)
