def write_packed_int(f, v):
    """ Writes the integer <v> packed to <f>. """
    if v == 0:
        f.write("\0")
    while v > 0:
        c = v & 127
        v >>= 7
        if v != 0:
            c = c | 128
        f.write(chr(c))
def write_packed_int ( f , v ) : if v == 0 : f . write ( "\0" ) while v > 0 : c = v & 127 v >>= 7 if v != 0 : c = c | 128 f . write ( chr ( c ) )
Writes the integer <v> packed to <f>.