'Get set of known topics.
Arguments:
exclude_internal_topics (bool): Whether records from internal topics
(such as offsets) should be exposed to the consumer. If set to
True the only way to receive records from an internal topic is
subscribing to it. Default True
Returns:
set: {topic (str), ...}'

def topics(self, exclude_internal_topics=True):

    topics = set(self._partitions.keys())
    if exclude_internal_topics:
        return (topics - self.internal_topics)
    else:
        return topics
