how to write the same java code in python
<p>please help me to write the java code in python, My goal is to make sure that every single line from output is stored / overwritten in the variable. </p>

<h1>Java</h1>

<pre><code>import java.lang.ProcessBuilder;
import java.lang.Process;

Process _process;
BufferedReader _terminal_output;

ProcessBuilder process_builder = new ProcessBuilder("curl","https://stream.twitter.com/1/statuses/filter.json?track=justinbieber,PerezHilton,KimKardashian,britneyspears", "-u", "user:pass");
try {
    _process = process_builder.start();
} catch (IOException e) {
    System.out.println("\n\nProcess Failed "+process_builder.toString());
    System.exit(1);
} 
_terminal_output = new BufferedReader(new InputStreamReader(_process.getInputStream()));
</code></pre>

<p>That's what I tried, but I don't see the output, and I guess the output deos not stored in the variable.</p>

<h1>Python</h1>

<pre><code>import subprocess

def curl(*args):
    curl_path = '/usr/bin/curl'
    curl_list = [curl_path]
    for arg in args:
        # loop just in case we want to filter args in future.
        curl_list.append(arg)
    _output = subprocess.Popen(
                 curl_list,
                 stderr=subprocess.PIPE,
                 stdout=subprocess.PIPE).communicate()[0]
    return _output

_terminal_output = curl('curl', "https://stream.twitter.com/1/statuses/filter.json?track=justinbieber,PerezHilton,KimKardashian,britneyspears", '-u', 'user:pass')
</code></pre>
