Καλησπερα αυτο που ζητας υπαρχει στην function isleap του calendar, οποτε μπορεις να χρησιμοποιησεις
return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
calendar.isleap(year)
To source του
def isleap(year😞
"""Return True for leap years, False for non-leap years."""
return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
https://github.com/python/cpython/blob/3.9/Lib/calendar.py