def validate_id_birthday(gd, fix_coordination_number_day=True):
 today = datetime.date.today()
 day = int(gd['day'])
 if (fix_coordination_number_day and (day > 60)):
  day -= 60
 if (gd['century'] is None):
  current_year = today.year
  year = ((int(today.strftime('%Y')) - int(today.strftime('%y'))) + int(gd['year']))
  if (('%s%s%02d' % (gd['year'], gd['month'], day)) > today.strftime('%y%m%d')):
   year -= 100
  if (gd['sign'] == '+'):
   year -= 100
 else:
  year = int((gd['century'] + gd['year']))
  if (year < 1800):
   raise ValueError
 birth_day = datetime.date(year, int(gd['month']), day)
 if (birth_day > today):
  raise ValueError
 return birth_day

def validate_id_birthday ( gd , fix_coordination_number_day = True ) : today = datetime . date . today ( ) day = int ( gd [ 'day' ] ) if ( fix_coordination_number_day and ( day > 60 ) ) : day -= 60 if ( gd [ 'century' ] is None ) : current_year = today . year year = ( ( int ( today . strftime ( '%Y' ) ) - int ( today . strftime ( '%y' ) ) ) + int ( gd [ 'year' ] ) ) if ( ( '%s%s%02d' % ( gd [ 'year' ] , gd [ 'month' ] , day ) ) > today . strftime ( '%y%m%d' ) ) : year -= 100 if ( gd [ 'sign' ] == '+' ) : year -= 100 else : year = int ( ( gd [ 'century' ] + gd [ 'year' ] ) ) if ( year < 1800 ) : raise ValueError birth_day = datetime . date ( year , int ( gd [ 'month' ] ) , day ) if ( birth_day > today ) : raise ValueError return birth_day
validates the birth_day and returns the datetime .