title: Spark RDD - Mapping with extra arguments
body: <p>Is it possible to pass extra arguments to the mapping function in pySpark?
  Specifically, I have the following code recipe: </p>
  
  <pre><code>raw_data_rdd = sc.textFile("data.json", use_unicode=True)
  json_data_rdd = raw_data_rdd.map(lambda line: json.loads(line))
  mapped_rdd = json_data_rdd.flatMap(processDataLine)
  </code></pre>
  
  <p>The function <code>processDataLine</code> takes extra arguments in addition to the JSON object, as:</p>
  
  <pre><code>def processDataLine(dataline, arg1, arg2)
  </code></pre>
  
  <p>How can I pass the extra arguments <code>arg1</code> and <code>arg2</code> to the <code>flaMap</code> function? </p>