What is the Python equivalent of PHP's set_time_limit()?
<p>I have a python script which is freezing (I think it stalls waiting for socket data somewhere), but I am having trouble getting a backtrace because the only way to stop it is to kill the process in. There is a timeout on the socket also, but it doesn't seem to work.</p>

<p>I am hoping that Python has a feature like PHP's <a href="http://www.php.net/set_time_limit" rel="nofollow">set_time_limit()</a> function which can stop the script and give me a useful backtrace, perhaps showing a <code>sock.recv()</code> call which is frozen, or an endless loop somewhere.</p>
