def reboot_node(self, node):
        """
        Shuts down a VM and then starts it again.
        """

        #Turn the VM off
        #Black magic to make the POST requests work
        d = self.connection._encode_multipart_formdata({'action':'stop'})
        self.connection.request(
                   '/rest/hosting/vm/%s' % node.id,
                   method='POST',
                   headers=d[0],
                   data=d[1]
        ).parse_body()

        node.state = NodeState.REBOOTING
        #Wait for it to turn off and then continue (to turn it on again)
        while node.state == NodeState.REBOOTING:
            #Check if it's off.
            response = self.connection.request(
                     node.id % '/rest/hosting/vm/%s'
                     ).parse_body()
            if response['vm']['state'] == 'off':
                node.state = NodeState.TERMINATED
            else:
                time.sleep(5)


        #Turn the VM back on.
        #Black magic to make the POST requests work
        d = self.connection._encode_multipart_formdata({'action':'start'})
        self.connection.request(
            '/rest/hosting/vm/%s' % node.id,
            method='POST',
            headers=d[0],
            data=d[1]
        ).parse_body()

        node.state = NodeState.RUNNING
        return True
dataset/ETHPy150Open secondstory/dewpoint/libcloud/drivers/ecp.py/ECPNodeDriver.reboot_node/swapped operands of `%`