from typing import Optional
from datetime import datetime


def determine_vaccine_date(vaccine_year: str, vaccine_month: str) -> Optional[str]:
    """
    Determine date of vaccination and return in datetime format as YYYY or
    YYYY-MM
    """
    if vaccine_year == '' or vaccine_year == 'Do not know':
        return None

    if vaccine_month == '' or vaccine_month == 'Do not know':
        return datetime.strptime(vaccine_year, '%Y').strftime('%Y')

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