from typing import Union
from pathlib import Path


def _filename(path: Union[str, Path]) -> str:
    """Get filename and extension from the full path."""
    if isinstance(path, str):
        return Path(path).name
    return path.name