code: def _build_partitions(self, assignment):
          
          self.partitions = {}
          for partition_name, replica_ids in six.iteritems(assignment):
              # Get topic
              topic_id = partition_name[0]
              partition_id = partition_name[1]
              topic = self.topics.setdefault(
                  topic_id,
                  Topic(topic_id, replication_factor=len(replica_ids))
              )
  
              # Creating partition object
              partition = Partition(
                  topic,
                  partition_id,
                  weight=self.partition_measurer.get_weight(partition_name),
                  size=self.partition_measurer.get_size(partition_name),
              )
              self.partitions[partition_name] = partition
              topic.add_partition(partition)
  
              # Updating corresponding broker objects
              for broker_id in replica_ids:
                  # Check if broker-id is present in current active brokers
                  if broker_id not in list(self.brokers.keys()):
                      self.log.warning(
                          "Broker %s containing partition %s is not in "
                          "active brokers.",
                          broker_id,
                          partition,
                      )
                      self.brokers[broker_id] = self._create_broker(broker_id)
  
                  self.brokers[broker_id].add_partition(partition)
docs: Builds all partition objects and update corresponding broker and
          topic objects.