Filtering python string through external program
<p>What's the cleanest way of filtering a Python string through an external program? In particular, how do you write the following function?</p>

<pre><code>def filter_through(s, ext_cmd):
  # Filters string s through ext_cmd, and returns the result.

# Example usage:
#   filter a multiline string through tac to reverse the order.
filter_through("one\ntwo\nthree\n", "tac")
#   =&gt; returns "three\ntwo\none\n"
</code></pre>

<p>Note: the example is only that - I realize there are much better ways of reversing lines in python.</p>
