merge iter_spider_classes and iter_command_classes

In utils.cmdline and utils.spider there were 2 almost duplicate functions (iter_command_classes, iter_spider_classes) that returns an iterator over the given module. I refactored it into iter_classes and changed the uses of the former 2 functions to the new one. It made allowing walk_modules in utils.misc to accept filepaths of the modules necessary. I've examined the code carefully. But, I might have missed something. So, please let me know and then I can make the necessary changes