from typing import Union
from pathlib import Path


def book_contents_path(path: Union[str, Path]) -> Path:
    """Return a book's json path, from a dirpath

    Input:
        path: A dir path containing a book.

    Outputs:
        path: A file path pointing to  book contents file (if exists).
    """
    path = Path(path)
    basename: str = path.name
    text_filepath: Path = path / f"{basename}.txt"
    return text_filepath