#NEWLINE# def _convert_ip_address( self , ip , field_name ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return netaddr . IPAddress ( ip ) #NEWLINE# #UNINDENT# except ( netaddr . AddrFormatError , ValueError ) : #NEWLINE# #INDENT# msg = ( _ ( '%(field_name)s: Invalid IP address (value=%(ip)s)' ) % { #NEWLINE# #INDENT# 'field_name' : field_name , #NEWLINE# 'ip' : ip , #NEWLINE# #UNINDENT# } ) #NEWLINE# raise forms . ValidationError ( msg )