def read_varint(readfn):
 b = ord(readfn(1))
 i = (b & 127)
 shift = 7
 while ((b & 128) != 0):
  b = ord(readfn(1))
  i |= ((b & 127) << shift)
  shift += 7
 return i

def read_varint ( readfn ) : b = ord ( readfn ( 1 ) ) i = ( b & 127 ) shift = 7 while ( ( b & 128 ) != 0 ) : b = ord ( readfn ( 1 ) ) i |= ( ( b & 127 ) << shift ) shift += 7 return i
reads a varint from the file .