<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_from_response(self, response, raise_exc=True):
 """ Updates internal state of object. :param response: The response object (dict). :type response: :py:class:`dict` :param raise_exc: Whether to raise an exception if the response indicates an error state. (default True) :type raise_exc: bool :raise stravalib.exc.ActivityUploadFailed: If the response indicates an error and raise_exc is True. """

        self.upload_id = response.get('id')
        self.external_id = response.get('external_id')
        self.activity_id = response.get('activity_id')
        self.status = response.get('status') or response.get('message')

        if response.get('error'):
            self.error = response.get('error')
        elif response.get('errors'):
            # This appears to be an undocumented API; ths is a bit of a hack for now.
            self.error = str(response.get('errors'))
        else:
            self.error = None

        if raise_exc:
            self.raise_for_error()