import datetime
from typing import Optional
from typing import List


def get_years(
        begin: datetime.datetime,
        end: Optional[datetime.datetime] = None,
    ) -> List[int]:
    """
    From the beginning datetime, get the years (as ints) that we are going to read.
    """
    max_year = datetime.datetime.utcnow().year if end is None else end.year
    return list(range(begin.year, max_year + 1))