def METHOD_NAME(states, output_dir, level, fips, location_id_matches: str, generate_api_v2: bool):
    # split columns by ',' and remove whitespace
    states = [c.strip() for c in states]
    states = [us.states.lookup(state).abbr for state in states]
    states = [state for state in states if state in ALL_STATES]
    # prepare data
    _cache_global_datasets()
    regions_dataset = combined_datasets.load_us_timeseries_dataset().get_subset(
        fips=fips,
        aggregation_level=level,
        exclude_county_999=True,
        states=states,
        location_id_matches=location_id_matches,
    )
    regions = [one_region for _, one_region in regions_dataset.iter_one_regions()]
    root.info(f"Executing pipeline for {len(regions)} regions")
    region_pipelines: List[OneRegionPipeline] = parallel_utils.parallel_map(
        OneRegionPipeline.run, regions
    )
    region_pipelines = _patch_nola_infection_rate_in_pipelines(region_pipelines)
    model_output = pyseir.run.PyseirOutputDatasets.from_pipeline_output(region_pipelines)
    model_output.write(output_dir, root)
    if generate_api_v2:
        api_v2_pipeline.generate_from_loaded_data(model_output, output_dir, regions_dataset, root)