How to filter out warning info
<p>My code imports a function(import_function) from the other module(written by other guys).</p>

<pre><code>ret = import_function(arg1,arg2)
</code></pre>

<p>The function will PRINT some warning info when it runs(the function uses print() to display the warning messages).
The question is: how can I filter out all these warning info? </p>

<p>I have tried the following way, but it doesn't work.</p>

<pre><code>console_redirect = sys.stdout
sys.stdout = os.devnull
ret = import_function(arg1,arg2)
sys.stdout = console_redirect
</code></pre>
