code: public static void writeStringToFile(String path, String toWrite, SparkContext sc) throws IOException {
          writeStringToFile(path, toWrite, sc.hadoopConfiguration());
      }
docs: Write a String to a file (on HDFS or local) in UTF-8 format
  
  @param path       Path to write to
  @param toWrite    String to write
  @param sc         Spark context