A couple of alternatives:
- return the generator and its length.
- refactor out the code that calculate the number of items/subtasks