def get_scraper(mod_path, scraper_type):
<EOL>try:<EOL><INDENT>module = importlib.import_module(mod_path)<EOL><DEDENT>except ImportError as e:<EOL><INDENT>raise ScrapeError("<STR_LIT>" % mod_path, e)<EOL><DEDENT>ScraperClass = None<EOL>for k, v in module.__dict__.items():<EOL><INDENT>if k.startswith('<STR_LIT:_>'):<EOL><INDENT>continue<EOL><DEDENT>if getattr(v, '<STR_LIT>', None) == scraper_type:<EOL><INDENT>if ScraperClass:<EOL><INDENT>raise ScrapeError("<STR_LIT>" %<EOL>(scraper_type, mod_path, ScraperClass, k))<EOL><DEDENT>ScraperClass = v<EOL><DEDENT><DEDENT>if not ScraperClass:<EOL><INDENT>raise ScrapeError("<STR_LIT>" % (<EOL>scraper_type, mod_path))<EOL><DEDENT>return ScraperClass<EOL>
import a scraper from the scraper registry