code: def _populate_sorted_partitions(self):
      # set of topic partitions with their respective potential consumers
      all_partitions = set(
          (tp, tuple(consumers))
          for tp, consumers in six.iteritems(
              self.partition_to_all_potential_consumers
          )
      )
      partitions_sorted_by_num_of_potential_consumers = sorted(
          all_partitions, key=partitions_comparator_key
      )
  
      self.sorted_partitions = []
      if (
          not self.is_fresh_assignment
          and self._are_subscriptions_identical()
      ):
          # if this is a reassignment and the subscriptions are identical (all consumers can consumer from all topics)
          # then we just need to simply list partitions in a round robin fashion (from consumers with
          # most assigned partitions to those with least)
          assignments = deepcopy(self.current_assignment)
          for consumer_id, partitions in six.iteritems(assignments):
              to_remove = []
              for partition in partitions:
                  if (
                      partition
                      not in self.partition_to_all_potential_consumers
                  ):
                      to_remove.append(partition)
              for partition in to_remove:
                  partitions.remove(partition)
  
          sorted_consumers = SortedSet(
              iterable=[
                  (consumer, tuple(partitions))
                  for consumer, partitions in six.iteritems(assignments)
              ],
              key=subscriptions_comparator_key,
          )
          # at this point, sorted_consumers contains an ascending-sorted list of consumers based on
          # how many valid partitions are currently assigned to them
          while sorted_consumers:
              # take the consumer with the most partitions
              consumer, _ = sorted_consumers.pop_last()
              # currently assigned partitions to this consumer
              remaining_partitions = assignments[consumer]
              # from partitions that had a different consumer before,
              # keep only those that are assigned to this consumer now
              previous_partitions = set(
                  six.iterkeys(self.previous_assignment)
              ).intersection(set(remaining_partitions))
              if previous_partitions:
                  # if there is a partition of this consumer that was assigned to another consumer before
                  # mark it as good options for reassignment
                  partition = previous_partitions.pop()
                  remaining_partitions.remove(partition)
                  self.sorted_partitions.append(partition)
                  sorted_consumers.add(
                      (consumer, tuple(assignments[consumer]))
                  )
              elif remaining_partitions:
                  # otherwise, mark any other one of the current partitions as a reassignment candidate
                  self.sorted_partitions.append(
                      remaining_partitions.pop()
                  )
                  sorted_consumers.add(
                      (consumer, tuple(assignments[consumer]))
                  )
  
          while partitions_sorted_by_num_of_potential_consumers:
              partition = (
                  partitions_sorted_by_num_of_potential_consumers.pop(
                      0
                  )[0]
              )
              if partition not in self.sorted_partitions:
                  self.sorted_partitions.append(partition)
      else:
          while partitions_sorted_by_num_of_potential_consumers:
              self.sorted_partitions.append(
                  partitions_sorted_by_num_of_potential_consumers.pop(
                      0
                  )[0]
              )
  
imports: import logging
  from collections import defaultdict, namedtuple
  from copy import deepcopy
  from kafka.cluster import ClusterMetadata
  from kafka.coordinator.assignors.abstract import AbstractPartitionAssignor
  from kafka.coordinator.assignors.sticky.partition_movements import PartitionMovements
  from kafka.coordinator.assignors.sticky.sorted_set import SortedSet
  from kafka.coordinator.protocol import ConsumerProtocolMemberMetadata, ConsumerProtocolMemberAssignment
  from kafka.coordinator.protocol import Schema
  from kafka.protocol.struct import Struct
  from kafka.protocol.types import String, Array, Int32
  from kafka.structs import TopicPartition
  from kafka.vendor import six
label_desc: Use image node_id 8 for calling the StickyAssignmentExecutor obj's underlying member method code with example usage: obj._populate_sorted_partitions() without return types