Return an encoder for a basic varint value.

def _VarintEncoder():
  """Return an encoder for a basic varint value."""

  local_chr = chr
  def EncodeVarint(write, value):
    bits = value & 0x7f
    value >>= 7
    while value:
      write(0x80|bits)
      bits = value & 0x7f
      value >>= 7
    return write(bits)

  return EncodeVarint