class_docstr: Implement a consistent hashing ring.
class_docstr_tok: ["Implement","a","consistent","hashing","ring","."]
docstr: Generic getter magic method.
  
  The node with the nearest but not less hash value is returned.
  
  :param key: the key to look for.
  :param what: the information to look for in, allowed values:
      - instance (default): associated node instance
      - nodename: node name
      - pos: index of the given key in the ring
      - tuple: ketama compatible (pos, name) tuple
      - weight: node weight
docstr_tok: ["Generic","getter","magic","method",".","The","node","with","the","nearest","but","not","less","hash","value","is","returned",".",":","param","key",":","the","key","to","look","for",".",":","param","what",":","the","information","to","look","for","in",",","allowed","values",":","-","instance","(","default",")",":","associated","node","instance","-","nodename",":","node","name","-","pos",":","index","of","the","given","key","in","the","ring","-","tuple",":","ketama","compatible","(","pos",",","name",")","tuple","-","weight",":","node","weight"]
code: def _get(self, key, what):
      """Generic getter magic method.
  
      The node with the nearest but not less hash value is returned.
  
      :param key: the key to look for.
      :param what: the information to look for in, allowed values:
          - instance (default): associated node instance
          - nodename: node name
          - pos: index of the given key in the ring
          - tuple: ketama compatible (pos, name) tuple
          - weight: node weight
      """
      if not self.runtime._ring:
          return None
  
      pos = self._get_pos(key)
      if what == "pos":
          return pos
  
      nodename = self.runtime._ring[self.runtime._keys[pos]]
      if what in ["hostname", "instance", "port", "weight"]:
          return self.runtime._nodes[nodename][what]
      elif what == "dict":
          return self.runtime._nodes[nodename]
      elif what == "nodename":
          return nodename
      elif what == "tuple":
          return (self.runtime._keys[pos], nodename)
  
imports: from bisect import bisect
  from .ring_ketama import KetamaRing
  from .ring_meta import MetaRing
label_desc: Use image node_id 7 for calling the HashRing obj's underlying member method code with example usage: obj._get(key, what) and returns: None, pos, self, self, nodename, self,  nodename