def primaryNodeNameForInstance(nodes, instanceId):
    primaryNames = {node.replicas[instanceId].primaryName for node in nodes}
    assert (1 == len(primaryNames))
    primaryReplicaName = next(iter(primaryNames))
    return primaryReplicaName[:(- 2)]
def primaryNodeNameForInstance(nodes, instanceId):
    primaryNames = {node.replicas[instanceId].primaryName for node in nodes}
    assert (1 == len(primaryNames))
    primaryReplicaName = next(iter(primaryNames))
    return primaryReplicaName[:(- 2)]