def spatial_coverage(resource_name):
    """
    Extract spatial coverage (country and state) for a given source.

    Args:
        resource_name (str): The name of the (potentially partitioned) resource
            for which we are enumerating the spatial coverage. Currently this
            is the only place we are able to access the partitioned spatial
            coverage after the ETL process has completed.

    Returns:
        dict: A dictionary containing country and potentially state level
        spatial coverage elements. Country keys are "country" for the full name
        of country, "iso_3166-1_alpha-2" for the 2-letter ISO code, and
        "iso_3166-1_alpha-3" for the 3-letter ISO code. State level elements
        are "state" (a two letter ISO code for sub-national jurisdiction) and
        "iso_3166-2" for the combined country-state code conforming to that
        standard.

    """
    coverage = {
        "country": "United States of America",
        # More generally... ISO 3166-1 2-letter country code:
        "iso_3166-1_alpha-2": "US",
        # More generally... ISO 3166-1 3-letter country code:
        "iso_3166-1_alpha-3": "USA",
    }
    if "hourly_emissions_epacems" in resource_name:
        us_state = resource_name.split("_")[4].upper()
        coverage["state"] = us_state
        # ISO3166-2:US code for the relevant state or outlying area:
        coverage["iso_3166-2"] = f"US-{us_state}"
    return coverage