def days_of_year(year):
    """
    通过判断闰年，获取年份year的总天数

    :param year: 年份, int
    :return:days_sum, 年份year的总天数, 366 or 365
    """
    year = int(year)
    assert isinstance(year, int), "Please enter integer, for example: 2018"

    if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
        days_sum = 366
    else:
        days_sum = 365

    return days_sum