import os def ensure_dir(path: str): """Ensure that a directory exists.""" if not os.path.exists(path): os.makedirs(path) def list_files(root: str, suffix: str): """Recursively list files ending with suffix.""" matches = [] for dirpath, _, filenames in os.walk(root): for f in filenames: if f.endswith(suffix): matches.append(os.path.join(dirpath, f)) return matches