'Undeploys existing node. Equal to vApp "stop" operation.
:param  node: The node to be deployed
:type   node: :class:`Node`
:rtype: :class:`Node`'

def ex_undeploy_node(self, node):

    data = {'xmlns': 'http://www.vmware.com/vcloud/v1.5'}
    undeploy_xml = ET.Element('UndeployVAppParams', data)
    undeploy_power_action_xml = ET.SubElement(undeploy_xml, 'UndeployPowerAction')
    undeploy_power_action_xml.text = 'shutdown'
    headers = {'Content-Type': 'application/vnd.vmware.vcloud.undeployVAppParams+xml'}
    try:
        res = self.connection.request(('%s/action/undeploy' % get_url_path(node.id)), data=ET.tostring(undeploy_xml), method='POST', headers=headers)
        self._wait_for_task_completion(res.object.get('href'))
    except Exception:
        undeploy_power_action_xml.text = 'powerOff'
        res = self.connection.request(('%s/action/undeploy' % get_url_path(node.id)), data=ET.tostring(undeploy_xml), method='POST', headers=headers)
        self._wait_for_task_completion(res.object.get('href'))
    res = self.connection.request(get_url_path(node.id))
    return self._to_node(res.object)
