human
5.3.3 Erweiterung auf Fingertabelle
assistant
#Here is the Python code you requested.
class FingerChordSearch(ChordSearch):
    
    def search(self, root_node=None, obj=None):
        
        peer = root_node if root_node else self.root_node
        obj = obj if obj else self.obj
        hops = 0
        while not self.is_responsible(peer, obj) and hops < 10:
            # sortierte menge der einzigartigen realen nachfolger
            fingers = sorted(set([f[1] for f in finger_map(peer, self.peers, self.M)]))
            
            # der naechste anzusprechende knoten ist der knoten mit 
            # id <= object_id < nachfolger id
            next_peer = None
            i = 0
            while i < len(fingers) and next_peer is None:
                finger = fingers[i]
                if finger >= obj:
                    next_peer = finger
                i += 1
            if next_peer is None:
                next_peer = fingers[-1]
            peer = next_peer
            hops += 1
        return (peer, hops)