def get_unavailable_brokers(zk, partition_metadata):
    """Returns the set of unavailable brokers from the difference of replica
    set of given partition to the set of available replicas.
    """
    topic_data = zk.get_topics(partition_metadata.topic)
    topic = partition_metadata.topic
    partition = partition_metadata.partition
    expected_replicas = set(topic_data[topic]['partitions'][str(partition)]
        ['replicas'])
    available_replicas = set(partition_metadata.replicas)
    return expected_replicas - available_replicas
