from pathlib import Path
from typing import Optional


def read_file(filename: Path) -> Optional[str]:
    """Return the contents of the file defined by filename."""
    try:
        return filename.read_text()
    except:
        return None