'Retrieve configuration templates and fill them with data pulled from docker and tags.'

def _get_check_configs(self, state, c_id, identifier, labels=None):

    platform_kwargs = {}
    if Platform.is_k8s():
        kube_metadata = (state.get_kube_config(c_id, 'metadata') or {})
        platform_kwargs = {'kube_container_name': state.get_kube_container_name(c_id), 'kube_annotations': kube_metadata.get('annotations')}
    if labels:
        platform_kwargs['docker_labels'] = labels
    config_templates = self._get_config_templates(identifier, **platform_kwargs)
    if (not config_templates):
        return None
    check_configs = []
    tags = self.get_tags(state, c_id)
    for config_tpl in config_templates:
        (source, config_tpl) = config_tpl
        (check_name, init_config_tpl, instance_tpl, variables) = config_tpl
        tmpl_array = instance_tpl
        if (not isinstance(instance_tpl, list)):
            tmpl_array = [instance_tpl]
        result_instances = []
        result_init_config = None
        for inst_tmpl in tmpl_array:
            (instance_tpl, var_values) = self._fill_tpl(state, c_id, inst_tmpl, variables, tags)
            tpl = self._render_template((init_config_tpl or {}), (instance_tpl or {}), var_values)
            if (tpl and (len(tpl) == 2)):
                (init_config, instance) = tpl
                result_instances.append(instance)
                if (not result_init_config):
                    result_init_config = init_config
                elif (result_init_config != init_config):
                    self.log.warning('Different    versions    of    `init_config`    found    for    check    {}.    Keeping    the    first    one    found.'.format('check_name'))
        check_configs.append((source, (check_name, result_init_config, result_instances)))
    return check_configs
