<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_state_success(self, model_output):
 """Update the state of the model run to 'SUCCESS'. Expects a model output result file. Will upload the file before changing the model run state. Raises an exception if update fails or resource is unknown. Parameters model_output : string Path to model run output file Returns ------- ModelRunHandle Refreshed run handle. """

        # Upload model output
        response = requests.post(
            self.links[REF_UPDATE_STATE_SUCCESS],
            files={'file': open(model_output, 'rb')}
        )
        if response.status_code != 200:
            try:
                raise ValueError(json.loads(response.text)['message'])
            except ValueError as ex:
                raise ValueError('invalid state change: ' + str(response.text))
        # Returned refreshed verion of the handle
        return self.refresh()