Update the state of a given model run. The state object is a Json
        representation of the state as created by the SCO-Server.

        Throws a ValueError if the resource is unknown or the update state
        request failed.

        Parameters
        ----------
        url : string
            Url to POST model run create model run request
        state_obj : Json object
            State object serialization as expected by the API.

def update_state(url, state_obj):
        """Update the state of a given model run. The state object is a Json
        representation of the state as created by the SCO-Server.

        Throws a ValueError if the resource is unknown or the update state
        request failed.

        Parameters
        ----------
        url : string
            Url to POST model run create model run request
        state_obj : Json object
            State object serialization as expected by the API.
        """
        # POST update run state request
        try:
            req = urllib2.Request(url)
            req.add_header('Content-Type', 'application/json')
            response = urllib2.urlopen(req, json.dumps(state_obj))
        except urllib2.URLError as ex:
            raise ValueError(str(ex))
        # Throw exception if resource was unknown or update request failed
        if response.code == 400:
            raise ValueError(response.message)
        elif response.code == 404:
            raise ValueError('unknown model run')