def date_fixup_pre_processor(transactions, tag, tag_dict, *args):
    """
    Replace illegal February 29, 30 dates with the last day of February.

    German banks use a variant of the 30/360 interest rate calculation,
    where each month has always 30 days even February. Python's datetime
    module won't accept such dates.
    """
    if tag_dict['month'] == '02':
        year = int(tag_dict['year'], 10)
        _, max_month_day = calendar.monthrange(year, 2)
        if int(tag_dict['day'], 10) > max_month_day:
            tag_dict['day'] = str(max_month_day)

    return tag_dict
def date_fixup_pre_processor ( transactions , tag , tag_dict , * args ) : if tag_dict [ 'month' ] == '02' : year = int ( tag_dict [ 'year' ] , 10 ) _ , max_month_day = calendar . monthrange ( year , 2 ) if int ( tag_dict [ 'day' ] , 10 ) > max_month_day : tag_dict [ 'day' ] = str ( max_month_day ) return tag_dict
Replace illegal February 29, 30 dates with the last day of February.

    German banks use a variant of the 30/360 interest rate calculation,
    where each month has always 30 days even February. Python's datetime
    module won't accept such dates.