'int and long values are written using variable-length, zig-zag coding.'

def read_long(self):

    b = ord(self.read(1))
    n = (b & 127)
    shift = 7
    while ((b & 128) != 0):
        b = ord(self.read(1))
        n |= ((b & 127) << shift)
        shift += 7
    datum = ((n >> 1) ^ (- (n & 1)))
    return datum
