title: How to read and write compressed sequence file in spark using Python with any supported compression codec
body: <p>How to read and write compressed <code>SequenceFile</code> in Spark using Python.</p>
  
  <p>I am using Spark 1.6 on CDH 5.12 Quickstart VM with Python 2.7</p>
  
  <p>Found example as below, but not working.</p>
  
  <p><code>rdd.saveAsSequenceFile(&lt;path location&gt;, Some(classOf[compressionCodecClass]))</code></p>
  
  <p><code>sparkContext.sequenceFile(&lt;path location&gt;,
                             classOf[&lt;class name&gt;],
                             classOf[&lt;compressionCodecClass &gt;]);</code></p>
  
  <p>Need working code to test.</p>