def _run_scraper(scraper_type, options, metadata):
_clear_scraped_data(options.output_dir, scraper_type)<EOL>scraper = _get_configured_scraper(scraper_type, options, metadata)<EOL>ua_email = os.environ.get('<STR_LIT>')<EOL>if ua_email and scraper:<EOL><INDENT>scraper.user_agent += '<STR_LIT>'.format(ua_email)<EOL><DEDENT>if not scraper:<EOL><INDENT>return [{<EOL>"<STR_LIT:type>": scraper_type,<EOL>"<STR_LIT>": dt.datetime.utcnow(),<EOL>"<STR_LIT>": True,<EOL>"<STR_LIT>": dt.datetime.utcnow()<EOL>}]<EOL><DEDENT>runs = []<EOL>scrape = {<EOL>"<STR_LIT:type>": scraper_type<EOL>}<EOL>scrape['<STR_LIT>'] = dt.datetime.utcnow()<EOL>if scraper_type in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>times = options.sessions<EOL>for time in times:<EOL><INDENT>scraper.validate_session(time, scraper.latest_only)<EOL><DEDENT><DEDENT>elif scraper_type in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>times = options.terms<EOL>for time in times:<EOL><INDENT>scraper.validate_term(time, scraper.latest_only)<EOL><DEDENT><DEDENT>for time in times:<EOL><INDENT>chambers = options.chambers<EOL>if scraper_type == '<STR_LIT>' and len(options.chambers) == <NUM_LIT:2>:<EOL><INDENT>chambers.append('<STR_LIT>')<EOL><DEDENT>if _is_old_scrape(scraper.scrape):<EOL><INDENT>for chamber in chambers:<EOL><INDENT>scraper.scrape(chamber, time)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>scraper.scrape(time, chambers=chambers)<EOL><DEDENT>if not scraper.object_count and scraper_type not in ('<STR_LIT>',<EOL>'<STR_LIT>'):<EOL><INDENT>raise ScrapeError("<STR_LIT>" %<EOL>scraper_type)<EOL><DEDENT><DEDENT>scrape['<STR_LIT>'] = dt.datetime.utcnow()<EOL>runs.append(scrape)<EOL>return runs<EOL>
scraper_type: bills, legislators, committees, votes