title: Timeout handling while using run_in_executor and asyncio
body: <p>I'm using asyncio to run a piece of blocking code like this:</p>
  
  <pre><code>result = await loop.run_in_executor(None, long_running_function)
  </code></pre>
  
  <p>My question is: Can I impose a timeout for the execution of <code>long_running_function</code>? </p>
  
  <p>Basically I don't want <code>long_running_function</code> to last more than 2 seconds and I can't do proper timeout handling within it because that function comes from a third-party library.</p>