def _parse_sv8_int(fileobj, limit=9):
 num = 0
 for i in xrange(limit):
  c = fileobj.read(1)
  if (len(c) != 1):
   raise EOFError
  c = bytearray(c)
  num = ((num << 7) | (c[0] & 127))
  if (not (c[0] & 128)):
   return (num, (i + 1))
 if (limit > 0):
  raise ValueError
 return (0, 0)

def _parse_sv8_int ( fileobj , limit = 9 ) : num = 0 for i in xrange ( limit ) : c = fileobj . read ( 1 ) if ( len ( c ) != 1 ) : raise EOFError c = bytearray ( c ) num = ( ( num << 7 ) | ( c [ 0 ] & 127 ) ) if ( not ( c [ 0 ] & 128 ) ) : return ( num , ( i + 1 ) ) if ( limit > 0 ) : raise ValueError return ( 0 , 0 )
reads bytes from fileobj until the msb is zero .