import json


def template_response(data, templating_dict):
    """
    Change data from the Grafana dashboard API response
    based on the dashboard templates
    :param data: Data from the Grafana dashboard API
    :param templating_dict: dictionary of {template_name, template _value}
    :return: panel_info with all templating values filled in
    """
    data = json.dumps(data)
    # Loop through all the templates and replace them if they're used in this panel
    for template in templating_dict:
        data = data.replace('${}'.format(template), templating_dict[template])
    return json.loads(data)