'Looks for autodiscovery configuration in a given source_dict (either docker labels
or kubernetes annotations) and returns it if found.'

def _extract_template(self, identifier, key_prefix, source_dict):

    try:
        check_names = json.loads(source_dict[(key_prefix + CHECK_NAMES)])
        init_config_tpls = json.loads(source_dict[(key_prefix + INIT_CONFIGS)])
        instance_tpls = json.loads(source_dict[(key_prefix + INSTANCES)])
        return [check_names, init_config_tpls, instance_tpls]
    except KeyError:
        return None
    except json.JSONDecodeError:
        log.exception(('Could    not    decode    the    JSON    configuration    template    for    the    entity    %s...' % identifier))
        return None
