def partitions_for_topic(self, topic):
        """This method first checks the local metadata cache for information
        about the topic. If the topic is not found (either because the topic
        does not exist, the user is not authorized to view the topic, or the
        metadata cache is not populated), then it will issue a metadata update
        call to the cluster.

        Arguments:
            topic (str): Topic to check.

        Returns:
            set: Partition ids
        """
        cluster = self._client.cluster
        partitions = cluster.partitions_for_topic(topic)
        if partitions is None:
            self._fetch_all_topic_metadata()
            partitions = cluster.partitions_for_topic(topic)
        return partitions or set()
This method first checks the local metadata cache for information
        about the topic. If the topic is not found (either because the topic
        does not exist, the user is not authorized to view the topic, or the
        metadata cache is not populated), then it will issue a metadata update
        call to the cluster.

        Arguments:
            topic (str): Topic to check.

        Returns:
            set: Partition ids
        
kafka/consumer/group.py