#NEWLINE# def supernet( self , prefixlen_diff = 1 , new_prefix = None ) : #NEWLINE# #INDENT# 'The supernet containing the current network.\n\n        Args:\n            prefixlen_diff: An integer, the amount the prefix length of\n              the network should be decreased by.  For example, given a\n              /24 network and a prefixlen_diff of 3, a supernet with a\n              /21 netmask is returned.\n\n        Returns:\n            An IPv4 network object.\n\n        Raises:\n            ValueError: If self.prefixlen - prefixlen_diff < 0. I.e., you have a\n              negative prefix length.\n                OR\n            If prefixlen_diff and new_prefix are both set or new_prefix is a\n              larger number than the current prefix (larger number means a\n              smaller network)\n\n        ' #NEWLINE# if ( self . _prefixlen == 0 ) : #NEWLINE# #INDENT# return self #NEWLINE# #UNINDENT# if ( new_prefix is not None ) : #NEWLINE# #INDENT# if ( new_prefix > self . _prefixlen ) : #NEWLINE# #INDENT# raise ValueError ( 'new prefix must be shorter' ) #NEWLINE# #UNINDENT# if ( prefixlen_diff != 1 ) : #NEWLINE# #INDENT# raise ValueError ( 'cannot set prefixlen_diff and new_prefix' ) #NEWLINE# #UNINDENT# prefixlen_diff = ( self . _prefixlen - new_prefix ) #NEWLINE# #UNINDENT# if ( ( self . prefixlen - prefixlen_diff ) < 0 ) : #NEWLINE# #INDENT# raise ValueError ( ( 'current prefixlen is %d, cannot have a prefixlen_diff of %d' % ( self . prefixlen , new_prefix ) ) ) #NEWLINE# #UNINDENT# return IPNetwork ( ( '%s/%s' % ( str ( self . network ) , str ( ( self . prefixlen - prefixlen_diff ) ) ) ) , version = self . _version )