code: 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))
docs: Writes the integer <v> packed to <f>.