<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cancel_subscription(self, sid):
 """ Unsubscribes from a previously configured subscription. """

        url = urljoin(self._url_base, self._event_sub_url)
        headers = dict(
            HOST=urlparse(url).netloc,
            SID=sid
        )
        resp = requests.request('UNSUBSCRIBE', url, headers=headers, auth=self.device.http_auth)
        resp.raise_for_status()