code: def unsubscribe(self):
          
          # Trying to unsubscribe if already unsubscribed, or not yet
          # subscribed, fails silently
          if self._has_been_unsubscribed or not self.is_subscribed:
              return
  
          # Cancel any auto renew
          self._auto_renew_thread_flag.set()
          # Send an unsubscribe request like this:
          # UNSUBSCRIBE publisher path HTTP/1.1
          # HOST: publisher host:publisher port
          # SID: uuid:subscription UUID
          headers = {
              'SID': self.sid
          }
          response = None
          try:
              response = requests.request(
                  'UNSUBSCRIBE',
                  self.service.base_url + self.service.event_subscription_url,
                  headers=headers,
                  timeout=3)
          except requests.exceptions.RequestException:
              pass
  
          self.is_subscribed = False
          self._timestamp = None
          log.info(
              "Unsubscribed from %s, sid: %s",
              self.service.base_url + self.service.event_subscription_url,
              self.sid)
          # remove queue from event queues and sid to service mappings
  
          with _subscriptions_lock:
              try:
                  del _subscriptions[self.sid]
              except KeyError:
                  pass
          self._has_been_unsubscribed = True
  
          # Ignore "412 Client Error: Precondition Failed for url:"
          # from rebooted speakers.
          if response and response.status_code != 412:
              response.raise_for_status()
docs: Unsubscribe from the service's events.
  
          Once unsubscribed, a Subscription instance should not be reused