code: def unsubscribe(self):
          
          self._subscription.unsubscribe()
          self._coordinator.close()
          self._client.cluster.need_all_topic_metadata = False
          self._client.set_topics([])
          log.debug("Unsubscribed all topics or patterns and assigned partitions")
docs: Unsubscribe from all topics and clear all assigned partitions.