Encode the given integer as a varint and return the bytes.  This is only
  called at startup time so it doesn't need to be fast.

def _VarintBytes(value):
  """Encode the given integer as a varint and return the bytes.  This is only
  called at startup time so it doesn't need to be fast."""

  pieces = []
  _EncodeVarint(pieces.append, value)
  return b"".join(pieces)