'Generate the spider module, based on the given template'

def _genspider(self, module, name, domain, template_name, template_file):

    tvars = {'project_name': self.settings.get('BOT_NAME'), 'ProjectName': string_camelcase(self.settings.get('BOT_NAME')), 'module': module, 'name': name, 'domain': domain, 'classname': ('%sSpider' % ''.join((s.capitalize() for s in module.split('_'))))}
    if self.settings.get('NEWSPIDER_MODULE'):
        spiders_module = import_module(self.settings['NEWSPIDER_MODULE'])
        spiders_dir = abspath(dirname(spiders_module.__file__))
    else:
        spiders_module = None
        spiders_dir = '.'
    spider_file = ('%s.py' % join(spiders_dir, module))
    shutil.copyfile(template_file, spider_file)
    render_templatefile(spider_file, **tvars)
    print(('Created    spider    %r    using    template    %r    ' % (name, template_name)), end=('' if spiders_module else '\n'))
    if spiders_module:
        print(('in    module:\n        %s.%s' % (spiders_module.__name__, module)))
