code: def unsubscribe(self, ssid, max_msgs=0):
          
          if self.is_closed:
              raise ErrConnectionClosed
  
          sub = None
          try:
              sub = self._subs[ssid]
          except KeyError:
              # Already unsubscribed.
              return
  
          # In case subscription has already received enough messages
          # then announce to the server that we are unsubscribing and
          # remove the callback locally too.
          if max_msgs == 0 or sub.received >= max_msgs:
              self._subs.pop(ssid, None)
              self._remove_subscription(sub)
  
          # We will send these for all subs when we reconnect anyway,
          # so that we can suppress here.
          if not self.is_reconnecting:
              yield self.auto_unsubscribe(ssid, max_msgs)
docs: Takes a subscription sequence id and removes the subscription
          from the client, optionally after receiving more than max_msgs,
          and unsubscribes immediatedly.