title: asyncio catch TimeoutError in Task
body: <p>I have an <code>asyncio.Task</code> that I need to cancel after some amount of time. Before cancelling, the task needs to do some cleanup. According to the docs, I should just be able to call task.cancel or <code>asyncio.wait_for(coroutine, delay)</code> and intercept an <code>asyncio.TimeoutError</code> in the coroutine, but the following example is not working. I've tried intercepting other errors, and calling <code>task.cancel</code> instead, but neither have worked. Am I misunderstanding how cancelling a task works?</p>
  
  <pre><code>@asyncio.coroutine
  def toTimeout():
    try:
      i = 0
      while True:
        print("iteration ", i, "......"); i += 1
        yield from asyncio.sleep(1)
    except asyncio.TimeoutError:
      print("timed out")
  
  def main():
    #... do some stuff
    yield from asyncio.wait_for(toTimeout(), 10)
    #... do some more stuff
  
  asyncio.get_event_loop().run_until_complete(main())
  asyncio.get_event_loop().run_forever()
  </code></pre>