import pathlib


def lambda_filtered_paths(directory: str):
    """
    Return list of filepaths for lambda layers and functions. Unecessary
    files are filtered out.
    """
    paths = pathlib.Path(directory).rglob("*")
    return [
        f
        for f in paths
        if not any(pat in str(f) for pat in ["__pycache__", ".mypy_cache", "~"])
    ]