import json


def get_file_names_mapping(path_to_file_map_json, workbook_dict):
    """
    Takes a path to the filename mapping and returns a dictionary which can be
    queried so that a file name can yield an identifier for respondents
    (currently a country).

    It asserts that the filenames provided match those found in the 'raw' directory.
    """
    temp_file_map = json.load(open(path_to_file_map_json, 'r'))
    # use set comparison to make sure there's no discrepancy between our mapping file and our directory
    assert (set(temp_file_map.keys()) == set(workbook_dict.keys()))
    return temp_file_map