code: def read_varint(readfn):
      """
      Reads a variable-length encoded integer.
  
      :param readfn: a callable that reads a given number of bytes,
          like file.read().
      """
  
      b = ord(readfn(1))
      i = b & 0x7F
  
      shift = 7
      while b & 0x80 != 0:
          b = ord(readfn(1))
          i |= (b & 0x7F) << shift
          shift += 7
      return i
  
file_path: whoosh/src/whoosh/util/varints.py
imports: from array import array
  from whoosh.compat import array_tobytes, xrange
label_desc: Use image node_id 6 for calling a global function with example usage: read_varint(readfn) and returns: i