class_docstr: A data structure that contains DHT peers bucketed according to their distance to node_id.
  Follows Kademlia routing table as described in https://pdos.csail.mit.edu/~petar/papers/maymounkov-kademlia-lncs.pdf
  
  :param node_id: node id used to measure distance
  :param bucket_size: parameter $k$ from Kademlia paper Section 2.2
  :param depth_modulo: parameter $b$ from Kademlia paper Section 2.2.
  :note: you can find a more detailed description of parameters in DHTNode, see node.py
class_docstr_tok: ["A","data","structure","that","contains","DHT","peers","bucketed","according","to","their","distance","to","node_id",".","Follows","Kademlia","routing","table","as","described","in","https",":","\/\/pdos.csail.mit.edu\/~petar\/papers\/maymounkov-kademlia-lncs.pdf",":","param","node_id",":","node","id","used","to","measure","distance",":","param","bucket_size",":","parameter","$","k","$","from","Kademlia","paper","Section","2.2",":","param","depth_modulo",":","parameter","$","b","$","from","Kademlia","paper","Section","2.2.",":","note",":","you","can","find","a","more","detailed","description","of","parameters","in","DHTNode",",","see","node.py"]
docstr: Get the index of the bucket that the given node would fall into.
docstr_tok: ["Get","the","index","of","the","bucket","that","the","given","node","would","fall","into","."]
code: def get_bucket_index(self, node_id: DHTID) -> int:
      """Get the index of the bucket that the given node would fall into."""
      lower_index, upper_index = 0, len(self.buckets)
      while upper_index - lower_index > 1:
          pivot_index = (lower_index + upper_index + 1) // 2
          if node_id >= self.buckets[pivot_index].lower:
              lower_index = pivot_index
          else:  # node_id < self.buckets[pivot_index].lower
              upper_index = pivot_index
      assert upper_index - lower_index == 1
      return lower_index
  
imports: from __future__ import annotations
  import hashlib
  import heapq
  import os
  import random
  from collections.abc import Iterable
  from itertools import chain
  from typing import Any, Dict, List, Optional, Sequence, Set, Tuple, Union
  from hivemind.p2p import PeerID
  from hivemind.utils import MSGPackSerializer, get_dht_time
label_desc: Use image node_id 2 for calling the RoutingTable obj's underlying member method code with example usage: obj.get_bucket_index(node_id) and returns: lower_index