import re


def get_config_file_values(config_file_path, keys_to_extract):
    """
    Read an o3de config file and extract specific keys if they are set

    @param config_file_path:    The o3de config file to parse
    @param keys_to_extract:     The specific keys to lookup the values if set
    @return: Dictionary of keys and its values (for matched keys)
    """
    result_map = {}
    with open(config_file_path, 'r') as config_file:
        bootstrap_contents = config_file.read()

        for search_key in keys_to_extract:
            search_result = re.search(r'^\s*{}\s*=\s*([\w\.]+)'.format(search_key), bootstrap_contents, re.MULTILINE)
            if search_result:
                result_value = search_result.group(1)
                result_map[search_key] = result_value

    return result_map