code: public static <T extends Writable> byte[] writableToByteArray(T writable)
        throws IOException {
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      DataOutputStream dos = new DataOutputStream(bos);
      writable.write(dos);
      dos.flush();
      return bos.toByteArray();
    }
docs: Write a writable to a byte array, e.g., to set metadata in a ZNode
  @param writable The writable object to write
  @return Writable object serialized to be a byte array
  @throws IOException If there is an error serializable the writable