def _build_topic_to_range_map(watermarks):
    """Builds a topic_to_range_map from a kafka get_topics_watermarks
    response"""
    return {
        topic: {
            partition: {
                'high': marks.highmark,
                'low': marks.lowmark
            }
            for partition, marks in watermarks_map.items()
        }
        for topic, watermarks_map in watermarks.items()
    }