code: def sort_by_distance(cls, consumer_offsets_metadata):
          
          sorted_offsets = sorted(
              list(consumer_offsets_metadata.items()),
              key=lambda topic_offsets: sum([o.highmark - o.current for o in topic_offsets[1]])
          )
          return OrderedDict(sorted_offsets)
docs: Receives a dict of (topic_name: ConsumerPartitionOffset) and returns a
          similar dict where the topics are sorted by total offset distance.