Getting 'lazy' - refactoring func into generator