code: def read_packed_int(f):
      
      ret = 0
      s = 0
      while True:
          b = ord(f.read(1))
          ret |= (b & 127) << s
          s += 7
          if b & 128 == 0:
              break
      return ret
docs: Reads a packed integer from the fileobj <f>.