#NEWLINE# def validate_id_birthday( gd , fix_coordination_number_day = True ) : #NEWLINE# #INDENT# '\n    Validates the birth_day and returns the datetime.date object for\n    the birth_day.\n\n    If the date is an invalid birth day, a ValueError will be raised.\n    ' #NEWLINE# today = datetime . date . today ( ) #NEWLINE# day = int ( gd [ 'day' ] ) #NEWLINE# if ( fix_coordination_number_day and ( day > 60 ) ) : #NEWLINE# #INDENT# day -= 60 #NEWLINE# #UNINDENT# if ( gd [ 'century' ] is None ) : #NEWLINE# #INDENT# current_year = today . year #NEWLINE# year = ( ( int ( today . strftime ( '%Y' ) ) - int ( today . strftime ( '%y' ) ) ) + int ( gd [ 'year' ] ) ) #NEWLINE# if ( ( '%s%s%02d' % ( gd [ 'year' ] , gd [ 'month' ] , day ) ) > today . strftime ( '%y%m%d' ) ) : #NEWLINE# #INDENT# year -= 100 #NEWLINE# #UNINDENT# if ( gd [ 'sign' ] == '+' ) : #NEWLINE# #INDENT# year -= 100 #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# year = int ( ( gd [ 'century' ] + gd [ 'year' ] ) ) #NEWLINE# if ( year < 1800 ) : #NEWLINE# #INDENT# raise ValueError #NEWLINE# #UNINDENT# #UNINDENT# birth_day = datetime . date ( year , int ( gd [ 'month' ] ) , day ) #NEWLINE# if ( birth_day > today ) : #NEWLINE# #INDENT# raise ValueError #NEWLINE# #UNINDENT# return birth_day