comparing Python code for equivalence
<p>Is there a reliable, automatic way (such as a command-line utility) to check if two Python files are <strong>equivalent</strong> modulo whitespace, semicolons, backslash continuations, comments, etc.? In other words, that they are identical to the interpreter?</p>

<p>For example, this:</p>

<pre><code>import sys
sys.stdout.write('foo\n')
sys.stdout.write('bar\n')
</code></pre>

<p>should be considered equivalent to this:</p>

<pre><code>import   sys
sys.stdout.\
    write('foo\n'); sys.stdout.\
    write(

    'bar\n') # This is an unnecessary comment
</code></pre>
