#NEWLINE# def _validate_ip_prefix( self , rule ) : #NEWLINE# #INDENT# 'Check that a valid cidr was specified as remote_ip_prefix\n\n        No need to check that it is in fact an IP address as this is already\n        validated by attribute validators.\n        Check that rule ethertype is consistent with remote_ip_prefix ip type.\n        Add mask to ip_prefix if absent (192.168.1.10 -> 192.168.1.10/32).\n        ' #NEWLINE# input_prefix = rule [ 'remote_ip_prefix' ] #NEWLINE# if input_prefix : #NEWLINE# #INDENT# addr = netaddr . IPNetwork ( input_prefix ) #NEWLINE# rule [ 'remote_ip_prefix' ] = str ( addr ) #NEWLINE# if ( rule [ 'ethertype' ] != ( 'IPv%d' % addr . version ) ) : #NEWLINE# #INDENT# raise ext_sg . SecurityGroupRuleParameterConflict ( ethertype = rule [ 'ethertype' ] , cidr = input_prefix )