#NEWLINE# def subnets( self , prefixlen_diff = 1 , new_prefix = None ) : #NEWLINE# #INDENT# 'The subnets which join to make the current subnet.\n\n        In the case that self contains only one IP\n        (self._prefixlen == 32 for IPv4 or self._prefixlen == 128\n        for IPv6), yield an iterator with just ourself.\n\n        Args:\n            prefixlen_diff: An integer, the amount the prefix length\n              should be increased by. This should not be set if\n              new_prefix is also set.\n            new_prefix: The desired new prefix length. This must be a\n              larger number (smaller prefix) than the existing prefix.\n              This should not be set if prefixlen_diff is also set.\n\n        Returns:\n            An iterator of IPv(4|6) objects.\n\n        Raises:\n            ValueError: The prefixlen_diff is too small or too large.\n                OR\n            prefixlen_diff and new_prefix are both set or new_prefix\n              is a smaller number than the current prefix (smaller\n              number means a larger network)\n\n        ' #NEWLINE# if ( self . _prefixlen == self . _max_prefixlen ) : #NEWLINE# #INDENT# ( yield self ) #NEWLINE# return #NEWLINE# #UNINDENT# if ( new_prefix is not None ) : #NEWLINE# #INDENT# if ( new_prefix < self . _prefixlen ) : #NEWLINE# #INDENT# raise ValueError ( 'new prefix must be longer' ) #NEWLINE# #UNINDENT# if ( prefixlen_diff != 1 ) : #NEWLINE# #INDENT# raise ValueError ( 'cannot set prefixlen_diff and new_prefix' ) #NEWLINE# #UNINDENT# prefixlen_diff = ( new_prefix - self . _prefixlen ) #NEWLINE# #UNINDENT# if ( prefixlen_diff < 0 ) : #NEWLINE# #INDENT# raise ValueError ( 'prefix length diff must be > 0' ) #NEWLINE# #UNINDENT# new_prefixlen = ( self . _prefixlen + prefixlen_diff ) #NEWLINE# if ( new_prefixlen > self . _max_prefixlen ) : #NEWLINE# #INDENT# raise ValueError ( ( 'prefix length diff %d is invalid for netblock %s' % ( new_prefixlen , self ) ) ) #NEWLINE# #UNINDENT# start = int ( self . network_address ) #NEWLINE# end = int ( self . broadcast_address ) #NEWLINE# step = ( ( int ( self . hostmask ) + 1 ) >> prefixlen_diff ) #NEWLINE# for new_addr in _compat_range ( start , end , step ) : #NEWLINE# #INDENT# current = self . __class__ ( ( new_addr , new_prefixlen ) ) #NEWLINE# ( yield current )