Complete the code to list the in-sync replicas (ISR) for a Kafka topic partition.
isr = admin_client.describe_topics(['[1]'])
The describe_topics method requires the topic name to fetch ISR info.
Complete the code to fetch the ISR list from the partition metadata.
isr_list = partition_metadata.[1]The isr attribute holds the list of in-sync replicas for the partition.
Fix the error in the code to correctly check if a replica is in the ISR set.
if replica_id [1] partition_metadata.isr: print('Replica is in ISR')
Use in to check if replica_id is inside the ISR list.
Fill both blanks to create a dictionary of partitions with their ISR counts.
isr_counts = {partition.partition: len(partition.[1]) for partition in topic_metadata.[2]Each partition's ISR list is accessed by isr, and partitions are listed in partitions.
Fill all three blanks to filter partitions with ISR count less than 3.
low_isr_partitions = {p.partition: len(p.[1]) for p in topic_metadata.[2] if len(p.[3]) < 3}We use isr to get the ISR list length and partitions to iterate all partitions.
