from pathlib import Path
import re


def is_year_folder(folder: str) -> bool:
    """Check if given folder is a folder that store all media from given year.

    Valid year-folder starts with 19 or 20 followed by two digits

    Args:
      folder: path to folder that has to be examined.

    Returns:
        True if folder is year-folder
    """
    last_part = Path(folder).parts[-1]
    is_four_digits = bool(re.match(r"^(19|20)\d{2}$", last_part))
    return is_four_digits