def get_layer_config(filepath, archive_config):
    """
    Parses a layer config XML file and its associated environment config file
    and returns a dict with relevant values. Generally, <TagName> turns into config['tag_name'].
    Arguments:
        filepath -- path to the layer config file
        archive config -- path to the archive config file
    """
    config = {}
    
    # Get the layer, environment, and archive config DOMs
    with open(filepath, "r") as lc:
        config_dom = xml.dom.minidom.parse(lc)
        env_config = config_dom.getElementsByTagName("EnvironmentConfig")[0].firstChild.nodeValue
    with open(env_config, "r") as env:
        env_dom = xml.dom.minidom.parse(env)
    with open(archive_config, "r") as archive:
        archive_dom = xml.dom.minidom.parse(archive)

    # Get archive root path and the archive location
    archive_root = config_dom.getElementsByTagName('ArchiveLocation')[0].attributes['root'].value
    config['archive_basepath'] = next(loc.getElementsByTagName('Location')[0].firstChild.nodeValue for loc in archive_dom.getElementsByTagName('Archive') if loc.attributes['id'].value == archive_root)
    config['archive_location'] = os.path.join(config['archive_basepath'], config_dom.getElementsByTagName('ArchiveLocation')[0].firstChild.nodeValue)

    # Add everything we need from the environment config
    staging_locations = env_dom.getElementsByTagName('StagingLocation')
    config['wmts_staging_location'] = next((loc.firstChild.nodeValue for loc in staging_locations if loc.attributes["service"].value == "wmts"), None)
    config['twms_staging_location'] = next((loc.firstChild.nodeValue for loc in staging_locations if loc.attributes["service"].value == "twms"), None)
    config['cache_location'] = next((loc.firstChild.nodeValue for loc in env_dom.getElementsByTagName("CacheLocation") if loc.attributes["service"].value == "wmts"), None)
    config['wmts_gc_path'] = next((loc.firstChild.nodeValue for loc in env_dom.getElementsByTagName("GetCapabilitiesLocation") if loc.attributes["service"].value == "wmts"), None)
    config['twms_gc_path'] = next((loc.firstChild.nodeValue for loc in env_dom.getElementsByTagName("GetCapabilitiesLocation") if loc.attributes["service"].value == "twms"), None)
    config['colormap_locations'] = [loc for loc in env_dom.getElementsByTagName("ColorMapLocation")]
    config['legend_location'] = env_dom.getElementsByTagName('LegendLocation')[0].firstChild.nodeValue

    # Add everything we need from the layer config
    config['prefix'] = config_dom.getElementsByTagName("FileNamePrefix")[0].firstChild.nodeValue
    config['identifier'] = config_dom.getElementsByTagName("Identifier")[0].firstChild.nodeValue
    config['time'] = config_dom.getElementsByTagName("Time")[0].firstChild.nodeValue
    config['tiled_group_name'] = config_dom.getElementsByTagName("TiledGroupName")[0].firstChild.nodeValue
    config['colormaps'] = config_dom.getElementsByTagName("ColorMap")

    try:
        config['empty_tile'] = config_dom.getElementsByTagName('EmptyTile')[0].firstChild.nodeValue
    except __HOLE__:
        config['empty_tile_size'] = config_dom.getElementsByTagName('EmptyTileSize')[0].firstChild.nodeValue
    config['year_dir'] = False
    try:
        if config_dom.getElementsByTagName('ArchiveLocation')[0].attributes['year'].value == 'true':
            config['year_dir'] = True
    except KeyError:
        pass

    return config
dataset/ETHPy150Open nasa-gibs/onearth/src/test/oe_test_utils.py/get_layer_config