A small stylistic note that you can feel free to ignore:

In Python, it's common to just write this as 

```
if not tasks_to_poll:
```

Performance wise, it's pretty much the same thing, but it's a little easier to read (and it's also pretty much how you would say what you are doing in English).