MORSE replay and simulation tooling may need to validate timestamps against the Gregorian calendar. Given an ending year, return every leap year from 1582 through that year, inclusive.
A year is a leap year if it is divisible by 400, or if it is divisible by 4 but not by 100. Use the proleptic Gregorian rules for all years in the requested range.
Implement leap_years(end_year), where end_year is an integer. Return a list of integers in ascending order. The range starts at 1582 and includes end_year. The caller supplies the current year explicitly so the function is deterministic and easy to test.
def leap_years(end_year):