'rename a cloud server, optionally specify hostname too'

def rename_node(self, node, name, hostname=None):

    data = {'name': name}
    if hostname:
        data['hostname'] = hostname
    params = urlencode(data)
    result = self.connection.request(('/server/cloud/%s/' % node.id), data=params, method='PUT').object
    return (result.get('response') in VALID_RESPONSE_CODES)
