def _read_file(filename: str, binary: bool = False) -> str:
    """Read a file and return its content."""
    if binary:
        mode = "rb"
        encoding = None
    else:
        mode = "r"
        encoding = "utf-8"

    with open(filename, mode, encoding="utf-8") as f:
        return f.read()