Find the bin where list n has ended up: Follow bin references until
    we find a bin that has not moved.

def _locate_bin(bins, n):
    """
    Find the bin where list n has ended up: Follow bin references until
    we find a bin that has not moved.
    """
    while bins[n] != n:
        n = bins[n]
    return n