code: def pack_int(v):
      
      if v == 0:
          return "\0"
      ret = ''
      while v > 0:
          c = v & 127
          v >>= 7
          if v != 0:
              c = c | 128
          ret += chr(c)
      return ret
docs: Returns <v> as packed string.