def get_engine_conf_file(sensor):
    """return the corresponding configuration file for passed in sensor (engine and version)"""
    # User's browser should be making request to dynamically update 'coverage' submission page
    # Also called by API handler
    try:
        conf_file = None
        custom_config = None
        try:
            # if custom config used
            # 'sensor' variable format example: suricata/5.0.0/mycustomfilename
            (engine, version, custom_config) = sensor.split("/", 2)
            epath = os.path.join(CONF_STORAGE_PATH, clean_path(engine))
            if os.path.isfile(os.path.join(epath, "%s" % custom_config)):
                conf_file = "%s" % custom_config
            elif os.path.isfile(os.path.join(epath, "%s.yaml" % custom_config)):
                conf_file = "%s.yaml" % custom_config
            elif os.path.isfile(os.path.join(epath, "%s.yml" % custom_config)):
                conf_file = "%s.yml" % custom_config
            elif os.path.isfile(os.path.join(epath, "%s.conf" % custom_config)):
                conf_file = "%s.conf" % custom_config
            if conf_file:
                conf_file = os.path.join(epath, clean_path(conf_file))
                logger.debug(f"Found custom config file: '{conf_file}'")
            else:
                logger.error(f"Unable to find custom config file '{custom_config}'")
                engine_config = f"# Unable to find custom config file '{custom_config}'"
                return engine_config
        except ValueError:
            # no custom config
            (engine, version) = sensor.split("/", 1)
            version = prefix_strip(version, prefixes="rust_")
            sensor2 = f"{engine}-{version}"
            epath = os.path.join(CONF_STORAGE_PATH, clean_path(engine))

            filelist = [
                f for f in os.listdir(epath) if os.path.isfile(os.path.join(epath, f))
            ]
            # assumes an extension (e.g. '.yaml', '.conf') on engine config files
            # if exact match, just use that instead of relying on LooseVersion
            files = [f for f in filelist if os.path.splitext(f)[0] == sensor2]
            if len(files) == 0:
                files = [
                    f
                    for f in filelist
                    if LooseVersion(os.path.splitext(f)[0]) <= LooseVersion(sensor2)
                ]
            if len(files) > 0:
                files.sort(
                    key=lambda v: LooseVersion(os.path.splitext(v)[0]), reverse=True
                )
                conf_file = os.path.join(epath, files[0])
            logger.debug(
                "in get_engine_conf_file(): passed sensor value: '%s', conf file used: '%s'",
                sensor,
                os.path.basename(conf_file),
            )

        engine_config = ""

        if conf_file:
            # open, read, return
            # Unix newline is \n but for display on web page, \r\n is desired in some
            # browsers/OSes.  Note: currently not converted back on job submit.
            with open(conf_file, "r") as fh:
                # want to parse each line so put it into a list
                contents = fh.readlines()
            logger.debug("Loading config file %s", conf_file)

            engine_config = "\r\n".join([x.rstrip("\r\n") for x in contents])
        else:
            logger.warning(
                "No suitable configuration file found for sensor '%s'.", sensor
            )
            engine_config = (
                f"# No suitable configuration file found for sensor '{sensor}'."
            )
        return engine_config

    except Exception as e:
        logger.error(
            "Problem getting configuration file for sensor '%s'.  Error: %s\n%s",
            sensor,
            e,
            traceback.format_exc(),
        )
        engine_config = f"# Exception getting configuration file for sensor '{sensor}'."
        if DEBUG:
            engine_config += f"  Error: {e}\r\n{traceback.format_exc()}"
        return engine_config
return the corresponding configuration file for passed in sensor (engine and version)
app/dalton.py