#NEWLINE# def _is_valid_ip( self , address ) : #NEWLINE# #INDENT# 'Validate the dotted decimal notation IP/netmask string.\n\n        Args:\n            address: A string, either representing a quad-dotted ip\n                or an integer which is a valid IPv4 IP address.\n\n        Returns:\n            A boolean, True if the string is a valid dotted decimal IP\n            string.\n\n        ' #NEWLINE# octets = address . split ( '.' ) #NEWLINE# if ( len ( octets ) == 1 ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return ( ( int ( address ) >= 0 ) and ( int ( address ) <= self . _ALL_ONES ) ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# if ( len ( octets ) != 4 ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# for octet in self : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if ( not ( 0 <= int ( octet ) <= 255 ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# except ValueError : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# return True