Add support for cancellation to our pycurl downloader.

I decided to go a little bit simple on my unit tests for this by calling cancel before we start the download. Though it seems strange to do it this way, it does allow for very simple assertions as to whether the loop executes or not, as we can simply verify whether the select() function was called.

If the reviewer does not care for this approach, a possible alternative is to mock something else inside the loop, have that mocked thing call cancel, and then verify that the loop stops some other way. I could see an argument for going with something like that, but I thought this approach was easier to understand for a future test reader. I preferred not to use threads so as not to introduce any race conditions.