title: Save Spark protobuf RDD to tfrecords
body: <p>I have a routine to save <code>tf.Example</code> protobuffs to tfrecords:</p>
  
  <pre><code>with tf.python_io.TFRecordWriter("dataset.tfrecord") as writer:
       writer.write(proto)
  </code></pre>
  
  <p>I have a Spark RDD full of <code>tf.Example</code>s. I don't want to write them to disk using <code>saveAsTextFile</code>, I want to save them using the <code>tf.python_io.TFRecordWriter</code>. How can I do this?</p>