downloads = {"guide": "volunteer-guide.pdf", "terms": "lending-terms.pdf"} def select_download(identifier): if identifier not in downloads: raise ValueError("unknown download") return downloads[identifier] assert select_download("guide") == "volunteer-guide.pdf" for value in ["../private.txt", "..\\private.txt", "/etc/passwd"]: try: select_download(value) except ValueError: continue raise AssertionError(value) print("known ID selected; three path inputs rejected")