def METHOD_NAME(package, pkg_files, formula_def, conn=None):
    """
    Check the filesystem for existing files
    """
    if conn is None:
        conn = init()
    node_type = str(__opts__.get("spm_node_type"))
    existing_files = []
    for member in pkg_files:
        if member.isdir():
            continue
        tld = formula_def.get("top_level_dir", package)
        new_name = member.name.replace("{}/".format(package), "")
        if not new_name.startswith(tld):
            continue
        if member.name.startswith("{}/_".format(package)):
            if node_type in ("master", "minion"):
                # Module files are distributed via extmods directory
                out_file = os.path.join(
                    salt.syspaths.CACHE_DIR,
                    node_type,
                    "extmods",
                    new_name.replace("_", ""),
                )
            else:
                # Module files are distributed via _modules, _states, etc
                out_file = os.path.join(conn["formula_path"], new_name)
        elif member.name == "{}/pillar.example".format(package):
            # Pillars are automatically put in the pillar_path
            new_name = "{}.sls.orig".format(package)
            out_file = os.path.join(conn["pillar_path"], new_name)
        elif package.endswith("-conf"):
            # Configuration files go into /etc/salt/
            out_file = os.path.join(salt.syspaths.CONFIG_DIR, new_name)
        elif package.endswith("-reactor"):
            # Reactor files go into /srv/reactor/
            out_file = os.path.join(conn["reactor_path"], member.name)
        else:
            out_file = os.path.join(conn["formula_path"], member.name)
        if os.path.exists(out_file):
            existing_files.append(out_file)
            if not __opts__["force"]:
                log.error("%s already exists, not installing", out_file)
    return existing_files