#NEWLINE# def address_exclude( self , other ) : #NEWLINE# #INDENT# "Remove an address from a larger block.\n\n        For example:\n\n            addr1 = ip_network('192.0.2.0/28')\n            addr2 = ip_network('192.0.2.1/32')\n            addr1.address_exclude(addr2) =\n                [IPv4Network('192.0.2.0/32'), IPv4Network('192.0.2.2/31'),\n                IPv4Network('192.0.2.4/30'), IPv4Network('192.0.2.8/29')]\n\n        or IPv6:\n\n            addr1 = ip_network('2001:db8::1/32')\n            addr2 = ip_network('2001:db8::1/128')\n            addr1.address_exclude(addr2) =\n                [ip_network('2001:db8::1/128'),\n                ip_network('2001:db8::2/127'),\n                ip_network('2001:db8::4/126'),\n                ip_network('2001:db8::8/125'),\n                ...\n                ip_network('2001:db8:8000::/33')]\n\n        Args:\n            other: An IPv4Network or IPv6Network object of the same type.\n\n        Returns:\n            An iterator of the IPv(4|6)Network objects which is self\n            minus other.\n\n        Raises:\n            TypeError: If self and other are of differing address\n              versions, or if other is not a network object.\n            ValueError: If other is not completely contained by self.\n\n        " #NEWLINE# if ( not ( self . _version == other . _version ) ) : #NEWLINE# #INDENT# raise TypeError ( ( '%s and %s are not of the same version' % ( self , other ) ) ) #NEWLINE# #UNINDENT# if ( not isinstance ( other , _BaseNetwork ) ) : #NEWLINE# #INDENT# raise TypeError ( ( '%s is not a network object' % other ) ) #NEWLINE# #UNINDENT# if ( not other . subnet_of ( self ) ) : #NEWLINE# #INDENT# raise ValueError ( ( '%s not contained in %s' % ( other , self ) ) ) #NEWLINE# #UNINDENT# if ( other == self ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# other = other . __class__ ( ( '%s/%s' % ( other . network_address , other . prefixlen ) ) ) #NEWLINE# ( s1 , s2 ) = self . subnets ( ) #NEWLINE# while ( ( s1 != other ) and ( s2 != other ) ) : #NEWLINE# #INDENT# if other . subnet_of ( s1 ) : #NEWLINE# #INDENT# ( yield s2 ) #NEWLINE# ( s1 , s2 ) = s1 . subnets ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if other . subnet_of ( s2 ) : #NEWLINE# #INDENT# ( yield s1 ) #NEWLINE# ( s1 , s2 ) = s2 . subnets ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise AssertionError ( ( 'Error performing exclusion: s1: %s s2: %s other: %s' % ( s1 , s2 , other ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( s1 == other ) : #NEWLINE# #INDENT# ( yield s2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( s2 == other ) : #NEWLINE# #INDENT# ( yield s1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise AssertionError ( ( 'Error performing exclusion: s1: %s s2: %s other: %s' % ( s1 , s2 , other ) ) )