refactor iter_classes code
Merge https://github.com/TamerTas/scrapy