+def temp_file(content: str) -> str:
+ """Create a temporary file and write text content into it."""
+ file = tempfile.mktemp()
+ with open(file, "w", encoding="utf-8") as f:
+ f.write(content)
+ return file
+
+
+def remove_file(path: T.Union[str, Path]) -> bool:
+ """Try to remove file without failing if it does not exist."""
+ try:
+ os.remove(path)
+ return True
+ except FileNotFoundError:
+ return False
+
+