from typing import Optional
from datetime import datetime


def vaccine_date(record: dict) -> Optional[str]:
    """ Converts a vaccination date to 'YYYY' or 'YYYY-MM' format. """
    year = record['vaccine_year']
    month = record['vaccine_1']

    if year == '' or year == 'Do not know':
        return None

    if month == 'Do not know':
        return datetime.strptime(year, '%Y').strftime('%Y')

    return datetime.strptime(f'{month} {year}', '%B %Y').strftime('%Y-%m')