from pathlib import Path


def _file_size_bytes(path: Path) -> int:
    """
    Total file size for the given file/directory.

    >>> import tempfile
    >>> test_dir = Path(tempfile.mkdtemp())
    >>> inner_dir = test_dir.joinpath('inner')
    >>> inner_dir.mkdir()
    >>> test_file = Path(inner_dir / 'test.txt')
    >>> test_file.write_text('asdf\\n')
    5
    >>> Path(inner_dir / 'other.txt').write_text('secondary\\n')
    10
    >>> _file_size_bytes(test_file)
    5
    >>> _file_size_bytes(inner_dir)
    15
    >>> _file_size_bytes(test_dir)
    15
    """
    if path.is_file():
        return path.stat().st_size

    return sum(
        _file_size_bytes(p)
        for p in path.iterdir()
    )