#NEWLINE# def clean( self , value ) : #NEWLINE# #INDENT# super ( USSocialSecurityNumberField , self ) . clean ( value ) #NEWLINE# if ( value in EMPTY_VALUES ) : #NEWLINE# #INDENT# return '' #NEWLINE# #UNINDENT# match = re . match ( ssn_re , value ) #NEWLINE# if ( not match ) : #NEWLINE# #INDENT# raise ValidationError ( self . error_messages [ 'invalid' ] ) #NEWLINE# #UNINDENT# ( area , group , serial ) = ( match . groupdict ( ) [ 'area' ] , match . groupdict ( ) [ 'group' ] , match . groupdict ( ) [ 'serial' ] ) #NEWLINE# if ( ( area == '000' ) or ( group == '00' ) or ( serial == '0000' ) ) : #NEWLINE# #INDENT# raise ValidationError ( self . error_messages [ 'invalid' ] ) #NEWLINE# #UNINDENT# if ( ( area == '666' ) or ( ( area == '987' ) and ( group == '65' ) and ( 4320 <= int ( serial ) <= 4329 ) ) or ( value == '078-05-1120' ) or ( value == '219-09-9999' ) ) : #NEWLINE# #INDENT# raise ValidationError ( self . error_messages [ 'invalid' ] ) #NEWLINE# #UNINDENT# return ( '%s-%s-%s' % ( area , group , serial ) )