code: def change_subscription(self, topics):
          
          if self._user_assignment:
              raise IllegalStateError(self._SUBSCRIPTION_EXCEPTION_MESSAGE)
  
          if isinstance(topics, six.string_types):
              topics = [topics]
  
          if self.subscription == set(topics):
              log.warning("subscription unchanged by change_subscription(%s)",
                          topics)
              return
  
          for t in topics:
              self._ensure_valid_topic_name(t)
  
          log.info('Updating subscribed topics to: %s', topics)
          self.subscription = set(topics)
          self._group_subscription.update(topics)
  
          # Remove any assigned partitions which are no longer subscribed to
          for tp in set(self.assignment.keys()):
              if tp.topic not in self.subscription:
                  del self.assignment[tp]
docs: Change the topic subscription.
  
          Arguments:
              topics (list of str): topics for subscription
  
          Raises:
              IllegalStateErrror: if assign_from_user has been used already
              TypeError: if a topic is None or a non-str
              ValueError: if a topic is an empty string or
                          - a topic name is '.' or '..' or
                          - a topic name does not consist of ASCII-characters/'-'/'_'/'.'