from pathlib import Path


def check_and_create(directory: Path) -> Path:
    """Create directory if it doesn't exist and return it."""
    if not directory.is_dir():
        directory.mkdir(parents=True, exist_ok=True)
    return directory