code: public void write(Object from, Writer target) throws IOException {
      ValueWriter valueWriter = WRITERS.findWriterFor(from);
      if (valueWriter == MAP_VALUE_WRITER || valueWriter == OBJECT_VALUE_WRITER) {
        WriterContext context = new WriterContext(indentationPolicy, datePolicy, target);
        valueWriter.write(from, context);
      } else {
        throw new IllegalArgumentException("An object of class " + from.getClass().getSimpleName() + " cannot produce valid TOML. Please pass in a Map or a custom type.");
      }
    }
docs: Write an Object in TOML to a {@link Writer}. You MUST ensure that the {@link Writer}s's encoding is set to UTF-8 for the TOML to be valid.
  
  @param from the object to be written. Can be a Map or a custom type. Must not be null.
  @param target the Writer to which TOML will be written. The Writer is not closed.
  @throws IOException if target.write() fails
  @throws IllegalArgumentException if from is of an invalid type