def get_near(friends, px, py, maxdist):
    i1 = bisect.bisect_left(friends, (px - maxdist, py))
i2 = bisect.bisect_right(friends, (px + maxdist, py))
return [(x, y) for x, y in friends[i1:i2] if math.hypot(px - x, py - y) <
    maxdist]
алгоритм поиска ближайших друзей?