#NEWLINE# def ipnetrange( startnet , number , increment = 1 ) : #NEWLINE# #INDENT# 'Return a list of consecutive networks, starting from initial\n    network and mask, keeping the mask constant.\n\n    Usage::\n        ipnetrange(startnet, number, [increment])\n\n    Where::\n        startnet is an IP address where the range will start.\n        number is the number of IP networks in the range\n        optional increment will skip that number of nets.\n\n    ' #NEWLINE# start = IPv4 ( startnet ) #NEWLINE# ips = [ ] #NEWLINE# baseaddress = start . address #NEWLINE# for i in range ( number ) : #NEWLINE# #INDENT# start . address = ( baseaddress + ( ( ( ~ start . mask ) + 1 ) * ( i * increment ) ) ) #NEWLINE# ips . append ( str ( start ) ) #NEWLINE# #UNINDENT# return ips